]> diplodocus.org Git - nmh/commitdiff
Fix free(3) of unmalloc()'d string in whatnow's refile.
authorRalph Corderoy <ralph@inputplus.co.uk>
Wed, 22 Mar 2017 14:47:18 +0000 (14:47 +0000)
committerRalph Corderoy <ralph@inputplus.co.uk>
Wed, 22 Mar 2017 14:47:18 +0000 (14:47 +0000)
`ref +foo' at comp(1)'s whatnow prompt was trying to free "+foo".
Take a copy of the string so the later free works.
Tom Rodman reported the problem to nmh-workers.
Bug introduced in 3b6be5607a251a3a793e97382e251ce66ea2bca0.

sbr/refile.c

index 43ad908..b3402cf 100644 (file)
@@ -29,7 +29,7 @@ refile (char **arg, char *file)
 
     if (arg) {
        while (*arg)
-           vec[vecp++] = *arg++;
+           vec[vecp++] = mh_xstrdup(*arg++);
     }
     vec[vecp] = NULL;