2
0
mirror of https://github.com/sudo-project/sudo.git synced 2025-08-29 13:28:10 +00:00

Avoid invalid read when minval > maxval

This commit is contained in:
Todd C. Miller 2019-10-24 18:35:45 -06:00
parent 271ead2fd3
commit aa99594575

View File

@ -173,8 +173,12 @@ done:
*errstrp = N_("value too large"); *errstrp = N_("value too large");
break; break;
} }
if (endp != NULL) if (endp != NULL) {
*endp = (char *)(errval == STN_INITIAL ? str : cp - 1); if (errval == STN_INITIAL || errval == STN_INVALID)
*endp = (char *)str;
else
*endp = (char *)(cp - 1);
}
return result; return result;
} }