mirror of
https://github.com/sudo-project/sudo.git
synced 2025-09-02 15:25:58 +00:00
Fix stronum() regress test and the errno value for out of range numbers.
This commit is contained in:
@@ -90,7 +90,7 @@ main(int argc, char *argv[])
|
|||||||
for (d = strtonum_data; d->str != NULL; d++) {
|
for (d = strtonum_data; d->str != NULL; d++) {
|
||||||
ntests++;
|
ntests++;
|
||||||
errstr = "some error";
|
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 (d->errnum != 0) {
|
||||||
if (errstr == NULL) {
|
if (errstr == NULL) {
|
||||||
sudo_warnx_nodebug("FAIL: \"%s\": missing errstr for errno %d",
|
sudo_warnx_nodebug("FAIL: \"%s\": missing errstr for errno %d",
|
||||||
|
@@ -154,8 +154,9 @@ done:
|
|||||||
break;
|
break;
|
||||||
case STN_TOOSMALL:
|
case STN_TOOSMALL:
|
||||||
/* Skip remaining digits. */
|
/* Skip remaining digits. */
|
||||||
while (isdigit(ch))
|
do {
|
||||||
ch = *cp++;
|
ch = *cp++;
|
||||||
|
} while (isdigit(ch));
|
||||||
result = 0;
|
result = 0;
|
||||||
errno = ERANGE;
|
errno = ERANGE;
|
||||||
if (errstrp != NULL)
|
if (errstrp != NULL)
|
||||||
@@ -163,8 +164,9 @@ done:
|
|||||||
break;
|
break;
|
||||||
case STN_TOOBIG:
|
case STN_TOOBIG:
|
||||||
/* Skip remaining digits. */
|
/* Skip remaining digits. */
|
||||||
while (isdigit(ch))
|
do {
|
||||||
ch = *cp++;
|
ch = *cp++;
|
||||||
|
} while (isdigit(ch));
|
||||||
result = 0;
|
result = 0;
|
||||||
errno = ERANGE;
|
errno = ERANGE;
|
||||||
if (errstrp != NULL)
|
if (errstrp != NULL)
|
||||||
|
Reference in New Issue
Block a user