From: Thomas Roessler Date: Tue, 7 Sep 1999 12:34:39 +0000 (+0000) Subject: Fix a strtok NULL pointer problem. X-Git-Tag: mutt-0-96-7-rel~12 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=491856cbb79b2f643facf291c1918bfb919966bd;p=mutt Fix a strtok NULL pointer problem. --- diff --git a/pgpkey.c b/pgpkey.c index 86ec9f86..aa8a8fc3 100644 --- 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);