mirror of
https://codeberg.org/libreboot/lbmk.git
synced 2026-07-13 06:49:52 +02:00
util/nvmutil: mitigate buggy libc i/o
Signed-off-by: Leah Rowe <leah@libreboot.org>
This commit is contained in:
@@ -1480,6 +1480,12 @@ read_again:
|
||||
* cause an overflow. Specifications guarantee
|
||||
* this won't happen, but spec != implementation
|
||||
*/
|
||||
if ((size_t)rv > SSIZE_MAX) {
|
||||
errno = EIO;
|
||||
return -1;
|
||||
/* we will not tolerate your buggy libc */
|
||||
}
|
||||
|
||||
if ((size_t)rv > (len - rc) /* Prevent overflow */
|
||||
|| rv == 0) { /* Prevent infinite 0-byte loop */
|
||||
if (rv == 0) {
|
||||
|
||||
Reference in New Issue
Block a user