mirror of
https://codeberg.org/libreboot/lbmk.git
synced 2026-07-22 14:36:31 +02:00
util/nvmutil: fix bad bound check
the current check is too liberal. make it sticter. the issue is that the previous check did not take into account that it's a check on a uint16_t array, against nf which refers to a number of bytes. Signed-off-by: Leah Rowe <leah@libreboot.org>
This commit is contained in:
@@ -425,7 +425,7 @@ check_bounds(int c, int p)
|
|||||||
{
|
{
|
||||||
if ((p != 0) && (p != 1))
|
if ((p != 0) && (p != 1))
|
||||||
err(SET_ERR(EINVAL), "check_bounds: invalid partnum %d", p);
|
err(SET_ERR(EINVAL), "check_bounds: invalid partnum %d", p);
|
||||||
if ((c < 0) || (c > nf))
|
if ((c < 0) || (c > ((nf >> 1) - 1)))
|
||||||
err(SET_ERR(EINVAL), "check_bounds: out of bounds %d", c);
|
err(SET_ERR(EINVAL), "check_bounds: out of bounds %d", c);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user