Skip to content

Commit

Permalink
Staging: bcm: Fix information leak in IOCTL_BCM_GET_DRIVER_VERSION
Browse files Browse the repository at this point in the history
This ioctl, IOCTL_BCM_GET_DRIVER_VERSION, is
responsible for sending the driver version
to userspace. However, the requested size stored
in IoBuffer.OutputLength may be incorrect.
Therefore, we altered the code to send the
exact length of the version, plus one for the
null character.

Signed-off-by: Kevin McKinney <klmckinney1@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
  • Loading branch information
Kevin McKinney authored and Greg Kroah-Hartman committed Dec 22, 2011
1 parent d1840ed commit b72a7c8
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion drivers/staging/bcm/Bcmchar.c
Original file line number Diff line number Diff line change
Expand Up @@ -999,11 +999,15 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg)
}

case IOCTL_BCM_GET_DRIVER_VERSION: {
ulong len;

/* Copy Ioctl Buffer structure */
if (copy_from_user(&IoBuffer, argp, sizeof(IOCTL_BUFFER)))
return -EFAULT;

if (copy_to_user(IoBuffer.OutputBuffer, VER_FILEVERSION_STR, IoBuffer.OutputLength))
len = min_t(ulong, IoBuffer.OutputLength, strlen(VER_FILEVERSION_STR) + 1);

if (copy_to_user(IoBuffer.OutputBuffer, VER_FILEVERSION_STR, len))
return -EFAULT;
Status = STATUS_SUCCESS;
break;
Expand Down

0 comments on commit b72a7c8

Please sign in to comment.