Skip to content

Commit a5f2b3d

Browse files
Chen Gangtorvalds
authored andcommitted
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>
1 parent 1b6b698 commit a5f2b3d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/char/ipmi/ipmi_bt_sm.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,9 @@ struct si_sm_data {
9595
enum bt_states state;
9696
unsigned char seq; /* BT sequence number */
9797
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 */
9999
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 */
101101
int read_count;
102102
int truncated;
103103
long timeout; /* microseconds countdown */

0 commit comments

Comments
 (0)