diff options
author | Colin Ian King <colin.king@canonical.com> | 2020-01-14 14:40:31 +0000 |
---|---|---|
committer | Corey Minyard <cminyard@mvista.com> | 2020-01-20 11:01:00 -0600 |
commit | e0354d147e5889b5faa12e64fa38187aed39aad4 (patch) | |
tree | 8cfed2b3cc8af82ff6a424a19f70c3c18ba79bfc | |
parent | 6b8526d3abc02c08a2f888e8c20b7ac9e5776dfe (diff) | |
download | linux-e0354d147e5889b5faa12e64fa38187aed39aad4.tar.gz linux-e0354d147e5889b5faa12e64fa38187aed39aad4.tar.bz2 linux-e0354d147e5889b5faa12e64fa38187aed39aad4.zip |
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: 51bd6f291583 ("Add support for IPMB driver")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Message-Id: <20200114144031.358003-1-colin.king@canonical.com>
Reviewed-by: Asmaa Mnebhi <asmaa@mellanox.com>
Signed-off-by: Corey Minyard <cminyard@mvista.com>
-rw-r--r-- | drivers/char/ipmi/ipmb_dev_int.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/char/ipmi/ipmb_dev_int.c b/drivers/char/ipmi/ipmb_dev_int.c index 9fdae83e59e0..382b28f1cf2f 100644 --- a/drivers/char/ipmi/ipmb_dev_int.c +++ b/drivers/char/ipmi/ipmb_dev_int.c @@ -279,7 +279,7 @@ static int ipmb_slave_cb(struct i2c_client *client, break; case I2C_SLAVE_WRITE_RECEIVED: - if (ipmb_dev->msg_idx >= sizeof(struct ipmb_msg)) + if (ipmb_dev->msg_idx >= sizeof(struct ipmb_msg) - 1) break; buf[++ipmb_dev->msg_idx] = *val; |