mirror of
https://github.com/pi-hole/dnsmasq.git
synced 2025-12-19 18:28:25 +00:00
Correctly return a heap-allocated empty string instead of NULL
Commit 32e15c3f45 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.
This commit is contained in:
@@ -663,7 +663,7 @@ static char *canonicalise_opt(char *s)
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (strlen(s) == 0)
|
if (strlen(s) == 0)
|
||||||
return opt_string_alloc("");
|
return opt_malloc(1); /* Heap-allocated empty string */
|
||||||
|
|
||||||
unhide_metas(s);
|
unhide_metas(s);
|
||||||
if (!(ret = canonicalise(s, &nomem)) && nomem)
|
if (!(ret = canonicalise(s, &nomem)) && nomem)
|
||||||
|
|||||||
Reference in New Issue
Block a user