mirror of
https://codeberg.org/libreboot/lbmk.git
synced 2026-07-11 05:52:36 +02:00
util/nvmutil: extra part check in set_checksum
it calls word() anyway, but we should still check it here, since this is quite a critical function. the other bound checks are done by word(), which this function uses to add everything up. Signed-off-by: Leah Rowe <leah@libreboot.org>
This commit is contained in:
@@ -617,6 +617,9 @@ set_checksum(size_t p)
|
||||
size_t c;
|
||||
uint16_t val16 = 0;
|
||||
|
||||
if (p > 1)
|
||||
err(ECANCELED, "Bad part num %zu (must be 0 or 1)", p);
|
||||
|
||||
for (c = 0; c < NVM_CHECKSUM_WORD; c++)
|
||||
val16 += word(c, p);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user