]> granicus.if.org Git - neomutt/commitdiff
Allow tab as a delimiter in smime .index files. (closes #3802)
authorKevin McCarthy <kevin@8t8.us>
Wed, 6 Jan 2016 02:08:07 +0000 (18:08 -0800)
committerKevin McCarthy <kevin@8t8.us>
Wed, 6 Jan 2016 02:08:07 +0000 (18:08 -0800)
The old parsing code used fscanf, and so happened to allow a tab as a
delimiter.  Even though smime_keys.pl uses a space, some users
maintain their own .index files by hand (using tab delimiters), so
continue to allow that delimiter.

Thanks to Andre for the bug report and patch.

smime.c

diff --git a/smime.c b/smime.c
index edd312b92c54bbb65ef5ffb09ee412ea794a9fbe..7f9a8b5373c2e2ee9f526c4b27fff253d191b337 100644 (file)
--- a/smime.c
+++ b/smime.c
@@ -509,7 +509,12 @@ static smime_key_t *smime_parse_key(char *buf)
 
   for (p = buf; p; p = pend)
   {
-    if ((pend = strchr (p, ' ')) || (pend = strchr (p, '\n')))
+    /* Some users manually maintain their .index file, and use a tab
+     * as a delimiter, which the old parsing code (using fscanf)
+     * happened to allow.  smime_keys.pl uses a space, so search for both.
+     */
+    if ((pend = strchr (p, ' ')) || (pend = strchr (p, '\t')) ||
+        (pend = strchr (p, '\n')))
       *pend++ = 0;
 
     /* For backward compatibility, don't count consecutive delimiters