aboutsummaryrefslogtreecommitdiffstats
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 fad04b66d268..0eb955ddc654 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)
776 int i; 776 int i;
777 777
778 if (atkbd->extra) 778 if (atkbd->extra)
779 sprintf(atkbd->name, "AT Set 2 Extra keyboard"); 779 snprintf(atkbd->name, sizeof(atkbd->name),
780 "AT Set 2 Extra keyboard");
780 else 781 else
781 sprintf(atkbd->name, "AT %s Set %d keyboard", 782 snprintf(atkbd->name, sizeof(atkbd->name),
782 atkbd->translated ? "Translated" : "Raw", atkbd->set); 783 "AT %s Set %d keyboard",
784 atkbd->translated ? "Translated" : "Raw", atkbd->set);
783 785
784 sprintf(atkbd->phys, "%s/input0", atkbd->ps2dev.serio->phys); 786 snprintf(atkbd->phys, sizeof(atkbd->phys),
787 "%s/input0", atkbd->ps2dev.serio->phys);
785 788
786 input_dev->name = atkbd->name; 789 input_dev->name = atkbd->name;
787 input_dev->phys = atkbd->phys; 790 input_dev->phys = atkbd->phys;