Skip to content

Commit 39ce735

Browse files
Colin Ian Kingcminyard
authored andcommitted
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: 0ba0c3c ("ipmi:ipmb: Add initial support for IPMI over IPMB") Signed-off-by: Colin Ian King <[email protected]> Message-Id: <[email protected]> Signed-off-by: Corey Minyard <[email protected]>
1 parent 8332cd4 commit 39ce735

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/char/ipmi/ipmi_ipmb.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ static int ipmi_ipmb_slave_cb(struct i2c_client *client,
192192
break;
193193

194194
case I2C_SLAVE_WRITE_RECEIVED:
195-
if (iidev->rcvlen > sizeof(iidev->rcvmsg))
195+
if (iidev->rcvlen >= sizeof(iidev->rcvmsg))
196196
iidev->overrun = true;
197197
else
198198
iidev->rcvmsg[iidev->rcvlen++] = *val;

0 commit comments

Comments
 (0)