mirror of
https://github.com/smaeul/u-boot.git
synced 2025-10-14 04:46:01 +01:00
i2c: fix stack buffer overflow vulnerability in i2c md command
This reinstates fix from commit 8f8c04bf1ebb ("i2c: fix stack buffer overflow vulnerability in i2c md command") without the changes unrelated to the actual fix. Avoid the underflow by setting only nbytes and linebytes as unsigned integers. Signed-off-by: Marek Vasut <marex@denx.de> Cc: Heiko Schocher <hs@denx.de> Cc: Nicolas Iooss <nicolas.iooss+uboot@ledger.fr> Cc: Simon Glass <sjg@chromium.org> Cc: Tim Harvey <tharvey@gateworks.com> Acked-by: Tim Harvey <tharvey@gateworks.com>
This commit is contained in:
parent
1aa9a04ff6
commit
e4573fef77
@ -470,7 +470,8 @@ static int do_i2c_md(struct cmd_tbl *cmdtp, int flag, int argc,
|
|||||||
uint chip;
|
uint chip;
|
||||||
uint addr, length;
|
uint addr, length;
|
||||||
int alen;
|
int alen;
|
||||||
int j, nbytes, linebytes;
|
int j;
|
||||||
|
uint nbytes, linebytes;
|
||||||
int ret;
|
int ret;
|
||||||
#if CONFIG_IS_ENABLED(DM_I2C)
|
#if CONFIG_IS_ENABLED(DM_I2C)
|
||||||
struct udevice *dev;
|
struct udevice *dev;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user