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

Mukherjee.
This commit is contained in:
Nicholas Marriott 2022-05-14 20:13:52 +01:00
parent 3b7dae9a53
commit 2cad9a6af8

View File

@ -831,6 +831,12 @@ args_strtonum(struct args *args, u_char flag, long long minval,
return (0); return (0);
} }
value = TAILQ_LAST(&entry->values, args_values); 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); ll = strtonum(value->string, minval, maxval, &errstr);
if (errstr != NULL) { if (errstr != NULL) {