mirror of
https://codeberg.org/libreboot/lbmk.git
synced 2026-07-11 05:52:36 +02:00
util/nvmutil: stricter check_bound
word/set_word are only meant to operate on the nvm area (128 bytes), but the current check is against the entire 4KB block. swap() only handles the nvm area, as per the design of nvmutil. this patch makes the boundary check truer to my real intent, guarding against future logical errors. Signed-off-by: Leah Rowe <leah@libreboot.org>
This commit is contained in:
@@ -510,7 +510,7 @@ check_bound(int c, int p)
|
||||
{
|
||||
if ((p != 0) && (p != 1))
|
||||
err(EINVAL, "check_bound: invalid partnum %d", p);
|
||||
if ((c < 0) || (c >= (SIZE_4KB >> 1)))
|
||||
if ((c < 0) || (c >= (NVM_SIZE >> 1)))
|
||||
err(EINVAL, "check_bound: out of bounds %d", c);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user