Skip to content

Commit

Permalink
Input: i8042 - fix incorrect usage of strncpy and strncat
Browse files Browse the repository at this point in the history
Fix incorrect length argument for strncpy and strncat by replacing them with
strlcpy and strlcat

Signed-off-by: Roel Kluin <12o3l@tiscali.nl>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
  • Loading branch information
Roel Kluin authored and Dmitry Torokhov committed Apr 24, 2008
1 parent d0478d0 commit 8c6deb9
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions drivers/input/serio/i8042-x86ia64io.h
Original file line number Diff line number Diff line change
Expand Up @@ -370,10 +370,10 @@ static int i8042_pnp_kbd_probe(struct pnp_dev *dev, const struct pnp_device_id *
if (pnp_irq_valid(dev,0))
i8042_pnp_kbd_irq = pnp_irq(dev, 0);

strncpy(i8042_pnp_kbd_name, did->id, sizeof(i8042_pnp_kbd_name));
strlcpy(i8042_pnp_kbd_name, did->id, sizeof(i8042_pnp_kbd_name));
if (strlen(pnp_dev_name(dev))) {
strncat(i8042_pnp_kbd_name, ":", sizeof(i8042_pnp_kbd_name));
strncat(i8042_pnp_kbd_name, pnp_dev_name(dev), sizeof(i8042_pnp_kbd_name));
strlcat(i8042_pnp_kbd_name, ":", sizeof(i8042_pnp_kbd_name));
strlcat(i8042_pnp_kbd_name, pnp_dev_name(dev), sizeof(i8042_pnp_kbd_name));
}

i8042_pnp_kbd_devices++;
Expand All @@ -391,10 +391,10 @@ static int i8042_pnp_aux_probe(struct pnp_dev *dev, const struct pnp_device_id *
if (pnp_irq_valid(dev, 0))
i8042_pnp_aux_irq = pnp_irq(dev, 0);

strncpy(i8042_pnp_aux_name, did->id, sizeof(i8042_pnp_aux_name));
strlcpy(i8042_pnp_aux_name, did->id, sizeof(i8042_pnp_aux_name));
if (strlen(pnp_dev_name(dev))) {
strncat(i8042_pnp_aux_name, ":", sizeof(i8042_pnp_aux_name));
strncat(i8042_pnp_aux_name, pnp_dev_name(dev), sizeof(i8042_pnp_aux_name));
strlcat(i8042_pnp_aux_name, ":", sizeof(i8042_pnp_aux_name));
strlcat(i8042_pnp_aux_name, pnp_dev_name(dev), sizeof(i8042_pnp_aux_name));
}

i8042_pnp_aux_devices++;
Expand Down

0 comments on commit 8c6deb9

Please sign in to comment.