From 4a2381eb6f9c985c78d9e4451c1501761362a2e5 Mon Sep 17 00:00:00 2001 From: Joachim Wiberg Date: Sun, 28 Apr 2024 14:22:57 +0200 Subject: [PATCH] Fix #404: possible undefined behavior --without-fstab Signed-off-by: Joachim Wiberg --- src/conf.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/conf.c b/src/conf.c index a01adbf5..1cfcd872 100644 --- a/src/conf.c +++ b/src/conf.c @@ -348,8 +348,11 @@ static void parse_kernel_loglevel(void) */ void conf_parse_cmdline(int argc, char *argv[]) { + const char *ptr; + /* Set up defaults */ - fstab = strdup(FINIT_FSTAB); + if ((ptr = FINIT_FSTAB)) + fstab = strdup(ptr); finit_conf = strdup(FINIT_CONF); finit_rcsd = strdup(FINIT_RCSD); path = getenv("PATH");