From 44a4643b620a86f1dea25235db1d4e75d21b4727 Mon Sep 17 00:00:00 2001 From: guns Date: Wed, 17 Nov 2021 14:15:35 -0600 Subject: 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. --- src/option.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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) -- cgit v1.2.1