]> git.ipfire.org Git - people/ms/dnsmasq.git/commitdiff
Fix crash at start up with conf-dir=/path,*
authorSimon Kelley <simon@thekelleys.org.uk>
Sat, 21 Nov 2015 21:47:41 +0000 (21:47 +0000)
committerSimon Kelley <simon@thekelleys.org.uk>
Sat, 21 Nov 2015 21:47:41 +0000 (21:47 +0000)
Thanks to Brian Carpenter and American Fuzzy Lop for finding the bug.

src/option.c

index 746cd117fe8647fd78df2b6722f1862c1ee82e80..71beb9801a85b0ea548d8367a4b993e648d45102 100644 (file)
@@ -1515,10 +1515,16 @@ static int one_opt(int option, char *arg, char *errstr, char *gen_err, int comma
                li = opt_malloc(sizeof(struct list));
                if (*arg == '*')
                  {
-                   li->next = match_suffix;
-                   match_suffix = li;
-                   /* Have to copy: buffer is overwritten */
-                   li->suffix = opt_string_alloc(arg+1);
+                   /* "*" with no suffix is a no-op */
+                   if (arg[1] == 0)
+                     free(li);
+                   else
+                     {
+                       li->next = match_suffix;
+                       match_suffix = li;
+                       /* Have to copy: buffer is overwritten */
+                       li->suffix = opt_string_alloc(arg+1);
+                     }
                  }
                else
                  {