Skip to content

Commit

Permalink
check_dummy: catch some cornercases
Browse files Browse the repository at this point in the history
  • Loading branch information
sni committed Jun 26, 2023
1 parent 7b064d9 commit df7bb62
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion neb_module_naemon/mod_gearman.c
Expand Up @@ -1980,6 +1980,10 @@ static int try_check_dummy(const char * command_line, host * hst, service * svc)

char *output = strtok( NULL, "");

if(output == NULL) {
output = "";
}

// string starts with single quote, take string until next single quote
if(output[0] == '"') {
output++;
Expand All @@ -1992,7 +1996,10 @@ static int try_check_dummy(const char * command_line, host * hst, service * svc)
}
// string starts with something else, parse till first whitespace
else {
output = strtok( output, " \t");
char *remain = strtok( output, " \t");
if(remain != NULL) {
output = remain;
}
}

if ( ( chk_result = ( check_result * )gm_malloc( sizeof *chk_result ) ) == 0 ) {
Expand Down

0 comments on commit df7bb62

Please sign in to comment.