Details

user warning: Got error 28 from storage engine query: SELECT t.*,v.weight AS v_weight_unused FROM term_node r INNER JOIN term_data t ON r.tid = t.tid INNER JOIN vocabulary v ON t.vid = v.vid WHERE r.vid = 109 ORDER BY v.weight, t.weight, t.name in /opt/drupal-6.33/modules/taxonomy/taxonomy.module on line 640.

[Home]

Issue of the Implementation # L0008

Brief

drivers/media/video/usbvideo/konicawc.c: Possible buffer overflow while use strncat

Detailed Description

       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));

Possible solutions

diff --git a/./a/drivers/media/video/usbvideo/konicawc.c 
b/./b/drivers/media/video/usbvideo/konicawc.c
index 31d57f2..a0addcb 100644
--- a/./a/drivers/media/video/usbvideo/konicawc.c
+++ b/./b/drivers/media/video/usbvideo/konicawc.c
@@ -225,7 +225,7 @@ static void konicawc_register_input(struct konicawc *cam, 
struct usb_device *dev
 	int error;
 
 	usb_make_path(dev, cam->input_physname, sizeof(cam->input_physname));
-	strncat(cam->input_physname, "/input0", sizeof(cam->input_physname));
+	strlcat(cam->input_physname, "/input0", sizeof(cam->input_physname));
 
 	cam->input = input_dev = input_allocate_device();
 	if (!input_dev) {

Component

linux-kernel 2.6.31

Accepted

http://lkml.org/lkml/2009/10/7/218
commit

Status

Fixed in kernel 2.6.33-rc1

[Home]