diff options
author | Alexander Strakh <strakh@ispras.ru> | 2009-11-17 17:43:38 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2009-12-05 15:41:36 -0500 |
commit | 2b588db82d2c210e84da129a223bb403d3131abe (patch) | |
tree | ed23a58a98f0d824faad688ff97bb5fc401aadb7 /drivers | |
parent | caac970f91f39f67b5e48680840605e24896ff99 (diff) |
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>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/media/video/usbvideo/quickcam_messenger.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/media/video/usbvideo/quickcam_messenger.c b/drivers/media/video/usbvideo/quickcam_messenger.c index 803d3e4e29a2..c4d1b96b5cee 100644 --- a/drivers/media/video/usbvideo/quickcam_messenger.c +++ b/drivers/media/video/usbvideo/quickcam_messenger.c | |||
@@ -89,7 +89,7 @@ static void qcm_register_input(struct qcm *cam, struct usb_device *dev) | |||
89 | int error; | 89 | int error; |
90 | 90 | ||
91 | usb_make_path(dev, cam->input_physname, sizeof(cam->input_physname)); | 91 | usb_make_path(dev, cam->input_physname, sizeof(cam->input_physname)); |
92 | strncat(cam->input_physname, "/input0", sizeof(cam->input_physname)); | 92 | strlcat(cam->input_physname, "/input0", sizeof(cam->input_physname)); |
93 | 93 | ||
94 | cam->input = input_dev = input_allocate_device(); | 94 | cam->input = input_dev = input_allocate_device(); |
95 | if (!input_dev) { | 95 | if (!input_dev) { |