diff --git a/unl0kr/unl0kr-agent.c b/unl0kr/unl0kr-agent.c index ef63486..95163bd 100644 --- a/unl0kr/unl0kr-agent.c +++ b/unl0kr/unl0kr-agent.c @@ -118,18 +118,16 @@ bool to_bool(const char* value) { if (strcmp(value, "true") == 0) { return true; - } else if (strcmp(value, "1") == 0) { - return true; - } else if (strcmp(value, "yes") == 0) { - return true; } else if (strcmp(value, "false") == 0) { return false; + } else if (strcmp(value, "1") == 0) { + return true; } else if (strcmp(value, "0") == 0) { return false; + } else if (strcmp(value, "yes") == 0) { + return true; } else if (strcmp(value, "no") == 0) { return false; - } else if (strcmp(value, "") == 0) { - return false; } else { fprintf(stderr, "The value '%s' is not a boolean\n", value); return false; @@ -145,6 +143,11 @@ int ini_parser(void* user, const char* section, const char* name, const char* va return 0; } + if (value[0] == 0x00) { + fprintf(stderr, "The ini file contains a key without a value: %s\n", name); + return 0; + } + if (strcmp(name, "NotAfter") == 0) { d->not_after = atol(value); } else if (strcmp(name, "Socket") == 0) {