summaryrefslogtreecommitdiffstats
path: root/pgpkey.c
diff options
context:
space:
mode:
authorThomas Roessler <roessler@does-not-exist.org>1999-09-07 12:34:39 +0000
committerThomas Roessler <roessler@does-not-exist.org>1999-09-07 12:34:39 +0000
commit491856cbb79b2f643facf291c1918bfb919966bd (patch)
tree3e30c8b8826413f3c07902d0580cfd356be00238 /pgpkey.c
parent458307e72af511d2fad7961fdd180f02b9f77256 (diff)
Fix a strtok NULL pointer problem.
Diffstat (limited to 'pgpkey.c')
-rw-r--r--pgpkey.c12
1 files changed, 7 insertions, 5 deletions
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);