ipmi: ipmb: Fix off-by-one size check on rcvlen
There is an off-by-one bounds check on the rcvlen causing a potential out of bounds write on iidev->rcvmsg. Fix this by using the >= operator on the bounds check rather than the > operator. Addresses-Coverity: ("Out-of-bounds write") Fixes: 0ba0c3c5d1c1 ("ipmi:ipmb: Add initial support for IPMI over IPMB") Signed-off-by: Colin Ian King <colin.king@canonical.com> Message-Id: <20211005151611.305383-1-colin.king@canonical.com> Signed-off-by: Corey Minyard <cminyard@mvista.com>
This commit is contained in:
parent
8332cd4936
commit
39ce735046
|
@ -192,7 +192,7 @@ static int ipmi_ipmb_slave_cb(struct i2c_client *client,
|
|||
break;
|
||||
|
||||
case I2C_SLAVE_WRITE_RECEIVED:
|
||||
if (iidev->rcvlen > sizeof(iidev->rcvmsg))
|
||||
if (iidev->rcvlen >= sizeof(iidev->rcvmsg))
|
||||
iidev->overrun = true;
|
||||
else
|
||||
iidev->rcvmsg[iidev->rcvlen++] = *val;
|
||||
|
|
Loading…
Reference in New Issue