Skip to content

Commit

Permalink
[PATCH] Open IPMI BT overflow
Browse files Browse the repository at this point in the history
I was looking into random driver code and found a suspicious looking
memcpy() in drivers/char/ipmi/ipmi_bt_sm.c on 2.6.17-rc1:

	if ((size < 2) || (size > IPMI_MAX_MSG_LENGTH))
		return -1;
	...
	memcpy(bt->write_data + 3, data + 1, size - 1);

where sizeof bt->write_data is IPMI_MAX_MSG_LENGTH.  It looks like the
memcpy would overflow by 2 bytes if size == IPMI_MAX_MSG_LENGTH.  A patch
attached to limit size to (IPMI_MAX_LENGTH - 2).

Cc: Corey Minyard <minyard@acm.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
  • Loading branch information
Heikki Orsila authored and Linus Torvalds committed Apr 19, 2006
1 parent aa1e816 commit 3fb0cb5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/char/ipmi/ipmi_bt_sm.c
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ static int bt_start_transaction(struct si_sm_data *bt,
{
unsigned int i;

if ((size < 2) || (size > IPMI_MAX_MSG_LENGTH))
if ((size < 2) || (size > (IPMI_MAX_MSG_LENGTH - 2)))
return -1;

if ((bt->state != BT_STATE_IDLE) && (bt->state != BT_STATE_HOSED))
Expand Down

0 comments on commit 3fb0cb5

Please sign in to comment.