1
0
mirror of https://github.com/benhoyt/inih.git synced 2025-01-28 22:52:54 +08:00

Ensure value passed to strcmp is non-NULL in unittest.c

Fixes #127. Thanks Seth Arnold.
This commit is contained in:
Ben Hoyt 2021-02-09 15:56:28 +13:00
parent cb55f57d87
commit e492a253ec

View File

@ -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;
}