aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/mouse/vsxxxaa.c
diff options
context:
space:
mode:
authorDmitry Torokhov <dtor_core@ameritech.net>2006-06-26 01:45:10 -0400
committerDmitry Torokhov <dtor_core@ameritech.net>2006-06-26 01:45:10 -0400
commit08ffce4560e0133e10634b0dd85eecee11257a1c (patch)
treeeff2a0266e0897e72e48db949fb28f367812222e /drivers/input/mouse/vsxxxaa.c
parent4854c7b27f0975a2b629f35ea3996d2968eb7c4f (diff)
Input: fix potential overflows in driver/input/mouse
Change all sprintfs into snprintfs to make sure we won't stomp on data adjacent to our buffers. Noticed by Wouter Paesen <wouter@kangaroot.net> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'drivers/input/mouse/vsxxxaa.c')
-rw-r--r--drivers/input/mouse/vsxxxaa.c22
1 files changed, 13 insertions, 9 deletions
diff --git a/drivers/input/mouse/vsxxxaa.c b/drivers/input/mouse/vsxxxaa.c
index 36e9442a16b2..7b85bc21ae4a 100644
--- a/drivers/input/mouse/vsxxxaa.c
+++ b/drivers/input/mouse/vsxxxaa.c
@@ -153,22 +153,25 @@ vsxxxaa_detection_done (struct vsxxxaa *mouse)
153{ 153{
154 switch (mouse->type) { 154 switch (mouse->type) {
155 case 0x02: 155 case 0x02:
156 sprintf (mouse->name, "DEC VSXXX-AA/-GA mouse"); 156 strlcpy (mouse->name, "DEC VSXXX-AA/-GA mouse",
157 sizeof (mouse->name));
157 break; 158 break;
158 159
159 case 0x04: 160 case 0x04:
160 sprintf (mouse->name, "DEC VSXXX-AB digitizer"); 161 strlcpy (mouse->name, "DEC VSXXX-AB digitizer",
162 sizeof (mouse->name));
161 break; 163 break;
162 164
163 default: 165 default:
164 sprintf (mouse->name, "unknown DEC pointer device " 166 snprintf (mouse->name, sizeof (mouse->name),
165 "(type = 0x%02x)", mouse->type); 167 "unknown DEC pointer device (type = 0x%02x)",
168 mouse->type);
166 break; 169 break;
167 } 170 }
168 171
169 printk (KERN_INFO "Found %s version 0x%02x from country 0x%02x " 172 printk (KERN_INFO
170 "on port %s\n", mouse->name, mouse->version, 173 "Found %s version 0x%02x from country 0x%02x on port %s\n",
171 mouse->country, mouse->phys); 174 mouse->name, mouse->version, mouse->country, mouse->phys);
172} 175}
173 176
174/* 177/*
@@ -503,8 +506,9 @@ vsxxxaa_connect (struct serio *serio, struct serio_driver *drv)
503 506
504 mouse->dev = input_dev; 507 mouse->dev = input_dev;
505 mouse->serio = serio; 508 mouse->serio = serio;
506 sprintf (mouse->name, "DEC VSXXX-AA/-GA mouse or VSXXX-AB digitizer"); 509 strlcat (mouse->name, "DEC VSXXX-AA/-GA mouse or VSXXX-AB digitizer",
507 sprintf (mouse->phys, "%s/input0", serio->phys); 510 sizeof (mouse->name));
511 snprintf (mouse->phys, sizeof (mouse->phys), "%s/input0", serio->phys);
508 512
509 input_dev->name = mouse->name; 513 input_dev->name = mouse->name;
510 input_dev->phys = mouse->phys; 514 input_dev->phys = mouse->phys;