Skip to content

Commit

Permalink
wext: Add bound checks for copy_from_user
Browse files Browse the repository at this point in the history
The wireless extensions have a copy_from_user to a local stack
array "essid", but both me and gcc have failed to find where
the bounds for this copy are located in the code.

This patch adds some basic sanity checks for the copy length
to make sure that we don't overflow the stack buffer.

Signed-off-by: Arjan van de Ven <arjan@linux.intel.com>
Cc: linux-wireless@vger.kernel.org
Signed-off-by: John W. Linville <linville@tuxdriver.com>
  • Loading branch information
Arjan van de Ven authored and John W. Linville committed Sep 28, 2009
1 parent 0ff7161 commit 8503bd8
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions net/wireless/wext.c
Original file line number Diff line number Diff line change
Expand Up @@ -773,10 +773,13 @@ static int ioctl_standard_iw_point(struct iw_point *iwp, unsigned int cmd,
essid_compat = 1;
else if (IW_IS_SET(cmd) && (iwp->length != 0)) {
char essid[IW_ESSID_MAX_SIZE + 1];
unsigned int len;
len = iwp->length * descr->token_size;

err = copy_from_user(essid, iwp->pointer,
iwp->length *
descr->token_size);
if (len > IW_ESSID_MAX_SIZE)
return -EFAULT;

err = copy_from_user(essid, iwp->pointer, len);
if (err)
return -EFAULT;

Expand Down

0 comments on commit 8503bd8

Please sign in to comment.