linux/drivers/media/video/usbvideo
Alexander Strakh 2b588db82d V4L/DVB (13379): quickcam_messenger: possible buffer overflow while use strncat
In driver ./drivers/media/video/usbvideo/quickcam_messenger.c in line 91:

  91         usb_make_path(dev, cam->input_physname, sizeof(cam->input_physname));

After this line we use strncat:

  92         strncat(cam->input_physname, "/input0", sizeof(cam->input_physname));

where sizeof(cam->input_physname) returns length of cam->input_phisname
without length for null-symbol.  But this parameter must be - "maximum
numbers of bytes to copy", i.e.:
sizeof(cam->input_physname)-strlen(cam->input_physname)-1.

In this case, after call to usb_make_path the similar drivers use strlcat.

Like in: drivers/hid/usbhid/hid-core.c:
1152         usb_make_path(dev, hid->phys, sizeof(hid->phys));
1153         strlcat(hid->phys, "/input", sizeof(hid->phys));

Found by Linux Driver Verification Project.

Use strlcat instead of strncat.

Signed-off-by: Alexander Strakh <strakh@ispras.ru>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-12-05 18:41:36 -02:00
..
Kconfig V4L/DVB (12088): Mark the v4l1 uvcvideo quickcam messenger driver as deprecated 2009-06-23 03:13:33 -03:00
Makefile
ibmcam.c V4L/DVB (10185): Use negated usb_endpoint_xfer_control, etc 2009-01-07 22:18:56 -02:00
konicawc.c V4L/DVB (13378): konicawc.c: possible buffer overflow while use strncat 2009-12-05 18:41:35 -02:00
quickcam_messenger.c V4L/DVB (13379): quickcam_messenger: possible buffer overflow while use strncat 2009-12-05 18:41:36 -02:00
quickcam_messenger.h V4L/DVB (5024): Fix quickcam communicator driver for big endian architectures 2007-01-15 16:25:48 -02:00
ultracam.c V4L/DVB (10185): Use negated usb_endpoint_xfer_control, etc 2009-01-07 22:18:56 -02:00
usbvideo.c V4L/DVB (10138): v4l2-ioctl: change to long return type to match unlocked_ioctl. 2009-01-02 17:11:34 -02:00
usbvideo.h V4L/DVB (8430): videodev: move some functions from v4l2-dev.h to v4l2-common.h or v4l2-ioctl.h 2008-07-23 19:00:17 -03:00
vicam.c headers: smp_lock.h redux 2009-07-12 12:22:34 -07:00