]> git.ipfire.org Git - people/jschlag/ipfire-2.x.git/blobdiff - src/patches/dnsmasq/015-Fix_crash_at_start_up_with_conf-dir.patch
dnsmasq 2.75: latest upstream patches
[people/jschlag/ipfire-2.x.git] / src / patches / dnsmasq / 015-Fix_crash_at_start_up_with_conf-dir.patch
diff --git a/src/patches/dnsmasq/015-Fix_crash_at_start_up_with_conf-dir.patch b/src/patches/dnsmasq/015-Fix_crash_at_start_up_with_conf-dir.patch
new file mode 100644 (file)
index 0000000..a9102c1
--- /dev/null
@@ -0,0 +1,38 @@
+From 0007ee90646a5a78a96ee729932e89d31c69513a Mon Sep 17 00:00:00 2001
+From: Simon Kelley <simon@thekelleys.org.uk>
+Date: Sat, 21 Nov 2015 21:47:41 +0000
+Subject: [PATCH] Fix crash at start up with conf-dir=/path,*
+
+Thanks to Brian Carpenter and American Fuzzy Lop for finding the bug.
+---
+ src/option.c |   14 ++++++++++----
+ 1 file changed, 10 insertions(+), 4 deletions(-)
+
+diff --git a/src/option.c b/src/option.c
+index 746cd11..71beb98 100644
+--- a/src/option.c
++++ b/src/option.c
+@@ -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
+                 {
+-- 
+1.7.10.4
+