aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChen Gang <gang.chen@asianux.com>2013-05-16 14:04:25 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-05-19 11:38:44 -0700
commit29a5fc4815c1ba9365e68927e0c4a267dbba87ca (patch)
tree741f04fa4e03d9aa0e91e54bcfc18c15768137f5
parentdce292e9ad1153354e730824f6d90df2c470784d (diff)
downloadvexpress-lsk-29a5fc4815c1ba9365e68927e0c4a267dbba87ca.tar.gz
drivers/char/ipmi: memcpy, need additional 2 bytes to avoid memory overflow
commit a5f2b3d6a738e7d4180012fe7b541172f8c8dcea upstream. When calling memcpy, read_data and write_data need additional 2 bytes. write_data: for checking: "if (size > IPMI_MAX_MSG_LENGTH)" for operating: "memcpy(bt->write_data + 3, data + 1, size - 1)" read_data: for checking: "if (msg_len < 3 || msg_len > IPMI_MAX_MSG_LENGTH)" for operating: "memcpy(data + 2, bt->read_data + 4, msg_len - 2)" Signed-off-by: Chen Gang <gang.chen@asianux.com> Signed-off-by: Corey Minyard <cminyard@mvista.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/char/ipmi/ipmi_bt_sm.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/char/ipmi/ipmi_bt_sm.c b/drivers/char/ipmi/ipmi_bt_sm.c
index cdd4c09fda9..a22a7a50274 100644
--- a/drivers/char/ipmi/ipmi_bt_sm.c
+++ b/drivers/char/ipmi/ipmi_bt_sm.c
@@ -95,9 +95,9 @@ struct si_sm_data {
enum bt_states state;
unsigned char seq; /* BT sequence number */
struct si_sm_io *io;
- unsigned char write_data[IPMI_MAX_MSG_LENGTH];
+ unsigned char write_data[IPMI_MAX_MSG_LENGTH + 2]; /* +2 for memcpy */
int write_count;
- unsigned char read_data[IPMI_MAX_MSG_LENGTH];
+ unsigned char read_data[IPMI_MAX_MSG_LENGTH + 2]; /* +2 for memcpy */
int read_count;
int truncated;
long timeout; /* microseconds countdown */