linux/drivers/media/usb
Dan Carpenter c1ced46c7b media: pvrusb2: Prevent a buffer overflow
The ctrl_check_input() function is called from pvr2_ctrl_range_check().
It's supposed to validate user supplied input and return true or false
depending on whether the input is valid or not.  The problem is that
negative shifts or shifts greater than 31 are undefined in C.  In
practice with GCC they result in shift wrapping so this function returns
true for some inputs which are not valid and this could result in a
buffer overflow:

    drivers/media/usb/pvrusb2/pvrusb2-ctrl.c:205 pvr2_ctrl_get_valname()
    warn: uncapped user index 'names[val]'

The cptr->hdw->input_allowed_mask mask is configured in pvr2_hdw_create()
and the highest valid bit is BIT(4).

Fixes: 7fb20fa38c ("V4L/DVB (7299): pvrusb2: Improve logic which handles input choice availability")

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2019-04-22 11:45:08 -04:00
..
airspy media: Kconfig files: use the right help coding style 2019-03-20 06:47:51 -04:00
as102 media: fix usage of whitespaces and on indentation 2018-01-04 13:12:01 -05:00
au0828 media: au0828: stop video streaming only when last user stops 2019-04-22 11:24:57 -04:00
b2c2 media: move dvb kAPI headers to include/media 2017-12-28 13:16:01 -05:00
cpia2 media: Kconfig files: use the right help coding style 2019-03-20 06:47:51 -04:00
cx231xx media: Kconfig files: use the right help coding style 2019-03-20 06:47:51 -04:00
dvb-usb media: usb: fix several typos 2019-03-01 09:43:27 -05:00
dvb-usb-v2 media: dvb: Add support for the Avermedia TD310 2019-03-19 16:52:51 -04:00
em28xx media: Kconfig files: use the right help coding style 2019-03-20 06:47:51 -04:00
go7007 media: replace strncpy() by strscpy() 2019-03-29 10:26:13 -04:00
gspca media: gspca: Kill URBs on USB device disconnect 2019-03-29 07:34:32 -04:00
hackrf media: Kconfig files: use the right help coding style 2019-03-20 06:47:51 -04:00
hdpvr media: replace strncpy() by strscpy() 2019-03-29 10:26:13 -04:00
msi2500 media updates for v4.20-rc1 2018-10-31 10:53:29 -07:00
pulse8-cec media: replace strncpy() by strscpy() 2019-03-29 10:26:13 -04:00
pvrusb2 media: pvrusb2: Prevent a buffer overflow 2019-04-22 11:45:08 -04:00
pwc media: pwc-ctl: pChoose can't be NULL 2019-03-25 18:02:27 -04:00
rainshadow-cec media: Kconfig files: use the right help coding style 2019-03-20 06:47:51 -04:00
s2255 media: use strscpy() instead of strlcpy() 2018-09-11 13:32:17 -04:00
siano media: Kconfig files: use the right help coding style 2019-03-20 06:47:51 -04:00
stk1160 media: Kconfig files: use the right help coding style 2019-03-20 06:47:51 -04:00
stkwebcam media: Kconfig files: use the right help coding style 2019-03-20 06:47:51 -04:00
tm6000 media: Kconfig files: use the right help coding style 2019-03-20 06:47:51 -04:00
ttusb-budget media: usb: fix several typos 2019-03-01 09:43:27 -05:00
ttusb-dec media: usb: fix several typos 2019-03-01 09:43:27 -05:00
usbtv media: Kconfig files: use the right help coding style 2019-03-20 06:47:51 -04:00
usbvision media: usbvision: fix a potential NULL pointer dereference 2019-03-29 07:42:56 -04:00
uvc media: Kconfig files: use the right help coding style 2019-03-20 06:47:51 -04:00
zr364xx media: Kconfig files: use the right help coding style 2019-03-20 06:47:51 -04:00
Kconfig [media] rainshadow-cec: new RainShadow Tech HDMI CEC driver 2017-04-10 12:42:10 -03:00
Makefile License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00