summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorguns <self@sungpae.com>2021-11-17 14:15:35 -0600
committerSimon Kelley <simon@thekelleys.org.uk>2021-12-04 12:03:31 +0000
commit44a4643b620a86f1dea25235db1d4e75d21b4727 (patch)
tree8e9b5b2f2fbed5ddab065623209d7d721064ffab
parented96efd865132dd9aa256c7873c6cdd5e985ee23 (diff)
downloaddnsmasq-44a4643b620a86f1dea25235db1d4e75d21b4727.tar.gz
Correctly return a heap-allocated empty string instead of NULL
Commit 32e15c3f458c2e8838a9ecf7d478ecb6750516bf added the following change: --- a/src/option.c +++ b/src/option.c @@ -654,7 +654,7 @@ static char *canonicalise_opt(char *s) return 0; if (strlen(s) == 0) - return ""; + return opt_string_alloc(""); unhide_metas(s); if (!(ret = canonicalise(s, &nomem)) && nomem) Unfortunately, opt_string_alloc(const char *cp) returns NULL when strlen(cp) == 0, which in turn causes --rebind-domain-ok='' to crash with SIGSEGV.
-rw-r--r--src/option.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/option.c b/src/option.c
index ac2ba20..9e315a5 100644
--- a/src/option.c
+++ b/src/option.c
@@ -663,7 +663,7 @@ static char *canonicalise_opt(char *s)
return 0;
if (strlen(s) == 0)
- return opt_string_alloc("");
+ return opt_malloc(1); /* Heap-allocated empty string */
unhide_metas(s);
if (!(ret = canonicalise(s, &nomem)) && nomem)