Skip to content

Commit e0354d1

Browse files
Colin Ian Kingcminyard
authored andcommitted
drivers: ipmi: fix off-by-one bounds check that leads to a out-of-bounds write
The end of buffer check is off-by-one since the check is against an index that is pre-incremented before a store to buf[]. Fix this adjusting the bounds check appropriately. Addresses-Coverity: ("Out-of-bounds write") Fixes: 51bd6f2 ("Add support for IPMB driver") Signed-off-by: Colin Ian King <[email protected]> Message-Id: <[email protected]> Reviewed-by: Asmaa Mnebhi <[email protected]> Signed-off-by: Corey Minyard <[email protected]>
1 parent 6b8526d commit e0354d1

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/char/ipmi/ipmb_dev_int.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ static int ipmb_slave_cb(struct i2c_client *client,
279279
break;
280280

281281
case I2C_SLAVE_WRITE_RECEIVED:
282-
if (ipmb_dev->msg_idx >= sizeof(struct ipmb_msg))
282+
if (ipmb_dev->msg_idx >= sizeof(struct ipmb_msg) - 1)
283283
break;
284284

285285
buf[++ipmb_dev->msg_idx] = *val;

0 commit comments

Comments
 (0)