Check if args_strtonum argument is NULL or not a string, from Anindya

Mukherjee.
pull/3196/head
Nicholas Marriott 2022-05-14 20:13:52 +01:00
parent 3b7dae9a53
commit 2cad9a6af8
1 changed files with 6 additions and 0 deletions

View File

@ -831,6 +831,12 @@ args_strtonum(struct args *args, u_char flag, long long minval,
return (0);
}
value = TAILQ_LAST(&entry->values, args_values);
if (value == NULL ||
value->type != ARGS_STRING ||
value->string == NULL) {
*cause = xstrdup("missing");
return (0);
}
ll = strtonum(value->string, minval, maxval, &errstr);
if (errstr != NULL) {