diff options
author | Alexander Strakh <strakh@ispras.ru> | 2009-11-17 17:43:37 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2009-12-05 15:41:35 -0500 |
commit | caac970f91f39f67b5e48680840605e24896ff99 (patch) | |
tree | 74a82f2ab094660ae9ae999974590714f41bd70a | |
parent | 38a54f35a0a90c0b62b111dd4de24248b22616b9 (diff) |
V4L/DVB (13378): konicawc.c: possible buffer overflow while use strncat
In driver ./drivers/media/video/usbvideo/konicawc.c in line 227:
227 usb_make_path(dev, cam->input_physname, sizeof(cam->input_physname));
After this line we use strncat:
228 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>
-rw-r--r-- | drivers/media/video/usbvideo/konicawc.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/media/video/usbvideo/konicawc.c b/drivers/media/video/usbvideo/konicawc.c index 31d57f2d09e1..a0addcb04295 100644 --- a/drivers/media/video/usbvideo/konicawc.c +++ b/drivers/media/video/usbvideo/konicawc.c | |||
@@ -225,7 +225,7 @@ static void konicawc_register_input(struct konicawc *cam, struct usb_device *dev | |||
225 | int error; | 225 | int error; |
226 | 226 | ||
227 | usb_make_path(dev, cam->input_physname, sizeof(cam->input_physname)); | 227 | usb_make_path(dev, cam->input_physname, sizeof(cam->input_physname)); |
228 | strncat(cam->input_physname, "/input0", sizeof(cam->input_physname)); | 228 | strlcat(cam->input_physname, "/input0", sizeof(cam->input_physname)); |
229 | 229 | ||
230 | cam->input = input_dev = input_allocate_device(); | 230 | cam->input = input_dev = input_allocate_device(); |
231 | if (!input_dev) { | 231 | if (!input_dev) { |