diff options
| author | Leah Rowe <leah@libreboot.org> | 2026-03-03 19:00:14 +0000 |
|---|---|---|
| committer | Leah Rowe <leah@libreboot.org> | 2026-03-03 19:00:14 +0000 |
| commit | 668dec36e91f2b35660767a20da07e8fbf123087 (patch) | |
| tree | cf6b719f2af8ba5550d7d8209623aa91de668a3d /util/nvmutil/nvmutil.c | |
| parent | 4775bb234889e42672dc45df87dc937c19ad5a2d (diff) | |
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>
Diffstat (limited to 'util/nvmutil/nvmutil.c')
| -rw-r--r-- | util/nvmutil/nvmutil.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/util/nvmutil/nvmutil.c b/util/nvmutil/nvmutil.c index ee4ba0d2..9a28cf4f 100644 --- a/util/nvmutil/nvmutil.c +++ b/util/nvmutil/nvmutil.c @@ -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; |
