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

Mukherjee.
pull/3201/head
nicm 2022-05-30 13:04:24 +00:00
parent af1496b300
commit 006a529db1
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) {