<<< Date Index >>>     <<< Thread Index >>>

[PATCH] smime segfault on empty keys/.index file



Dear all,

While trying to resolve my struggle with adding a S/MIME key to my account
(see post on mutt-users) and by manually tinkering with files, I got mutt
to segfault repeatedly.

The attached (tiny) patch should prevent this from happening when the
.smime/keys/.index file exists but is empty.

I realise the fix is a trivial one, but hopefully it'll still be of some
use to you.

Sincerely,

Remco
# HG changeset patch
# User Remco Rijnders <remco@xxxxxxxxxxxxxxx>
# Date 1284268564 -7200
# Branch HEAD
# Node ID 10069d5277ad29b73764cebc3bbe53eea55286c8
# Parent  0f962f1a6bbba4684f8ca0d29916b54be852421b
Fixed segfault when .smime/keys/.index is empty and the S/MIME encryption menu 
is used

diff -r 0f962f1a6bbb -r 10069d5277ad smime.c
--- a/smime.c   Sat Sep 11 07:34:26 2010 -0700
+++ b/smime.c   Sun Sep 12 07:16:04 2010 +0200
@@ -463,7 +463,7 @@
           break;
       }
     }
-    if (hash) {
+    if (hash && cur) {
       fname = safe_malloc(13); /* Hash + '.' + Suffix + \0 */
       sprintf(fname, "%.8x.%i", Table[cur].hash, Table[cur].suffix);
     }

Attachment: signature.asc
Description: Digital signature