aboutsummaryrefslogtreecommitdiff
path: root/drivers/input/keyboard/atkbd.c
diff options
context:
space:
mode:
authorDmitry Torokhov <dtor_core@ameritech.net>2006-06-26 01:46:17 -0400
committerDmitry Torokhov <dtor_core@ameritech.net>2006-06-26 01:46:17 -0400
commitea08c6faa0a8dc93b016663de55e49822ed0b33f (patch)
treea1cc8a448e87457c8f8ed45d5f9f430369eb4062 /drivers/input/keyboard/atkbd.c
parenta21466cc77b25dc2afd1292c79c7fc8fd454a1a7 (diff)
Input: fix potential overflows in driver/input/keyboard
Change all sprintfs into snprintfs to make sure we won't stomp on data adjacent to our buffers. Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'drivers/input/keyboard/atkbd.c')
-rw-r--r--drivers/input/keyboard/atkbd.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/drivers/input/keyboard/atkbd.c b/drivers/input/keyboard/atkbd.c
index fad04b66d26..0eb955ddc65 100644
--- a/drivers/input/keyboard/atkbd.c
+++ b/drivers/input/keyboard/atkbd.c
@@ -776,12 +776,15 @@ static void atkbd_set_device_attrs(struct atkbd *atkbd)
int i;
if (atkbd->extra)
- sprintf(atkbd->name, "AT Set 2 Extra keyboard");
+ snprintf(atkbd->name, sizeof(atkbd->name),
+ "AT Set 2 Extra keyboard");
else
- sprintf(atkbd->name, "AT %s Set %d keyboard",
- atkbd->translated ? "Translated" : "Raw", atkbd->set);
+ snprintf(atkbd->name, sizeof(atkbd->name),
+ "AT %s Set %d keyboard",
+ atkbd->translated ? "Translated" : "Raw", atkbd->set);
- sprintf(atkbd->phys, "%s/input0", atkbd->ps2dev.serio->phys);
+ snprintf(atkbd->phys, sizeof(atkbd->phys),
+ "%s/input0", atkbd->ps2dev.serio->phys);
input_dev->name = atkbd->name;
input_dev->phys = atkbd->phys;