mirror of
https://codeberg.org/libreboot/lbmk.git
synced 2026-07-11 05:52:36 +02:00
util/nvmutil rhex: check against sizeof(rnum)
checking against -1 is incorrect, because we specifically want to ensure that it always read the number of bytes defined by the size of rnum. this still covers the case where the return value is -1, and therefore makes the error handling much stricter. Signed-off-by: Leah Rowe <leah@libreboot.org>
This commit is contained in:
@@ -368,7 +368,7 @@ rhex(void)
|
||||
|
||||
if (!n) {
|
||||
n = sizeof(rnum) - 1;
|
||||
err_if(read(rfd, (uint8_t *) &rnum, n + 1) == -1);
|
||||
err_if(read(rfd, (uint8_t *) &rnum, n + 1) != sizeof(rnum));
|
||||
}
|
||||
|
||||
return rnum[n--] & 0xf;
|
||||
|
||||
Reference in New Issue
Block a user