From e492a253ec2fb4a60bf68b2c9257f2b9dca759ee Mon Sep 17 00:00:00 2001 From: Ben Hoyt Date: Tue, 9 Feb 2021 15:56:28 +1300 Subject: [PATCH] Ensure value passed to strcmp is non-NULL in unittest.c Fixes #127. Thanks Seth Arnold. --- tests/unittest.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/unittest.c b/tests/unittest.c index 3e85dad..fde8e61 100644 --- a/tests/unittest.c +++ b/tests/unittest.c @@ -42,6 +42,11 @@ int dumper(void* user, const char* section, const char* name, printf("... %s%s%s;\n", name, value ? "=" : "", value ? value : ""); #endif + if (!value) { + // Happens when INI_ALLOW_NO_VALUE=1 and line has no value (no '=' or ':') + return 1; + } + return strcmp(name, "user")==0 && strcmp(value, "parse_error")==0 ? 0 : 1; }