Skip to content

Commit

Permalink
Staging: vt6655-6: check keysize before memcpy()
Browse files Browse the repository at this point in the history
We need to check the we don't copy too much memory.  This comes from a
copy_from_user() in the ioctl.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Dan Carpenter authored and Greg Kroah-Hartman committed Apr 10, 2012
1 parent 401c90e commit 4ca5218
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions drivers/staging/vt6655/key.c
Original file line number Diff line number Diff line change
Expand Up @@ -655,6 +655,9 @@ bool KeybSetDefaultKey (
return (false);
}

if (uKeyLength > MAX_KEY_LEN)
return false;

pTable->KeyTable[MAX_KEY_TABLE-1].bInUse = true;
for(ii=0;ii<ETH_ALEN;ii++)
pTable->KeyTable[MAX_KEY_TABLE-1].abyBSSID[ii] = 0xFF;
Expand Down
3 changes: 3 additions & 0 deletions drivers/staging/vt6656/key.c
Original file line number Diff line number Diff line change
Expand Up @@ -684,6 +684,9 @@ BOOL KeybSetDefaultKey(
return (FALSE);
}

if (uKeyLength > MAX_KEY_LEN)
return false;

pTable->KeyTable[MAX_KEY_TABLE-1].bInUse = TRUE;
for (ii = 0; ii < ETH_ALEN; ii++)
pTable->KeyTable[MAX_KEY_TABLE-1].abyBSSID[ii] = 0xFF;
Expand Down

0 comments on commit 4ca5218

Please sign in to comment.