diff options
author | Chen Gang <gang.chen@asianux.com> | 2013-05-16 15:04:25 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-05-16 16:49:25 -0400 |
commit | a5f2b3d6a738e7d4180012fe7b541172f8c8dcea (patch) | |
tree | b234eea77819c6fc89529468b0b8db9b6e7bcf8a /drivers/char/ipmi | |
parent | 1b6b698f53b3a5382a907308048d77c8bacca4ab (diff) |
drivers/char/ipmi: memcpy, need additional 2 bytes to avoid memory overflow
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>
Cc: stable@vger.kernel.org
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/char/ipmi')
-rw-r--r-- | drivers/char/ipmi/ipmi_bt_sm.c | 4 |
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 cdd4c09fda96..a22a7a502740 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 { | |||
95 | enum bt_states state; | 95 | enum bt_states state; |
96 | unsigned char seq; /* BT sequence number */ | 96 | unsigned char seq; /* BT sequence number */ |
97 | struct si_sm_io *io; | 97 | struct si_sm_io *io; |
98 | unsigned char write_data[IPMI_MAX_MSG_LENGTH]; | 98 | unsigned char write_data[IPMI_MAX_MSG_LENGTH + 2]; /* +2 for memcpy */ |
99 | int write_count; | 99 | int write_count; |
100 | unsigned char read_data[IPMI_MAX_MSG_LENGTH]; | 100 | unsigned char read_data[IPMI_MAX_MSG_LENGTH + 2]; /* +2 for memcpy */ |
101 | int read_count; | 101 | int read_count; |
102 | int truncated; | 102 | int truncated; |
103 | long timeout; /* microseconds countdown */ | 103 | long timeout; /* microseconds countdown */ |