]> granicus.if.org Git - neomutt/commitdiff
Fix a strtok NULL pointer problem.
authorThomas Roessler <roessler@does-not-exist.org>
Tue, 7 Sep 1999 12:34:39 +0000 (12:34 +0000)
committerThomas Roessler <roessler@does-not-exist.org>
Tue, 7 Sep 1999 12:34:39 +0000 (12:34 +0000)
pgpkey.c

index 86ec9f86d9708ef287790f0fc6e8b5f685ef9b4e..aa8a8fc393dd0511a9fc6d8513d97ee62c3886da 100644 (file)
--- a/pgpkey.c
+++ b/pgpkey.c
@@ -718,15 +718,17 @@ BODY *pgp_make_key_attachment (char *tempf)
 
 static LIST *pgp_add_string_to_hints (LIST *hints, const char *str)
 {
-  char *scratch = safe_strdup (str);
+  char *scratch;
   char *t;
-  
-  t = strtok (scratch, " ,.:\"()<>\n");
-  while (t)
+
+  if ((scratch = safe_strdup (str)) == NULL)
+    return hints;
+
+  for (t = strtok (scratch, " ,.:\"()<>\n"); t;
+                       t = strtok (NULL, " ,.:\"()<>\n"))
   {
     if (strlen (t) > 3)
       hints = mutt_add_list (hints, t);
-    t = strtok (NULL, " ,.:\"()<>\n");
   }
 
   safe_free ((void **) &scratch);