2
0
mirror of https://github.com/sudo-project/sudo.git synced 2025-08-31 06:15:37 +00:00

Fix stronum() regress test and the errno value for out of range numbers.

This commit is contained in:
Todd C. Miller
2019-10-16 09:37:41 -06:00
parent 29afe160a2
commit e339d9950d
2 changed files with 5 additions and 3 deletions

View File

@@ -90,7 +90,7 @@ main(int argc, char *argv[])
for (d = strtonum_data; d->str != NULL; d++) {
ntests++;
errstr = "some error";
value = strtonum(d->str, d->minval, d->maxval, &errstr);
value = sudo_strtonum(d->str, d->minval, d->maxval, &errstr);
if (d->errnum != 0) {
if (errstr == NULL) {
sudo_warnx_nodebug("FAIL: \"%s\": missing errstr for errno %d",

View File

@@ -154,8 +154,9 @@ done:
break;
case STN_TOOSMALL:
/* Skip remaining digits. */
while (isdigit(ch))
do {
ch = *cp++;
} while (isdigit(ch));
result = 0;
errno = ERANGE;
if (errstrp != NULL)
@@ -163,8 +164,9 @@ done:
break;
case STN_TOOBIG:
/* Skip remaining digits. */
while (isdigit(ch))
do {
ch = *cp++;
} while (isdigit(ch));
result = 0;
errno = ERANGE;
if (errstrp != NULL)