Re: [PATCH] Input: mouse: vsxxxaa: Replace strlcat() with strscpy()
From: Alejandro Colomar
Date: Wed Nov 04 2026 - 06:23:23 EST
Hi Mariia,
> Date: 2026-11-03 22:23:18-0800
> From: Mariia Nikitash <nikitash.mariiaw@xxxxxxxxx>
>
> In preparation for removing the deprecated strlcat() API[1], use
> strscpy() to initialize the mouse device name.
>
> The destination is zero-initialized, and the constant string fits
> within the buffer. Since the return value is unused, this preserves
> the existing behavior.
Huh! Indeed, it was very weird that it was using strlcat(3), when
strlcpy(3) would have been okay. The commit that added strlcat(3) was
obviously confused: 08ffce4560e0 (2006-06-26; "Input: fix potential
overflows in driver/input/mouse").
>
> Link: https://github.com/KSPP/linux/issues/370 [1]
> Signed-off-by: Mariia Nikitash <nikitash.mariiaw@xxxxxxxxx>
Reviewed-by: Alejandro Colomar <alx@xxxxxxxxxx>
Have a lovely day!
Alex
> ---
> drivers/input/mouse/vsxxxaa.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/input/mouse/vsxxxaa.c b/drivers/input/mouse/vsxxxaa.c
> index 042a17fe81db..b3a0d7ff5738 100644
> --- a/drivers/input/mouse/vsxxxaa.c
> +++ b/drivers/input/mouse/vsxxxaa.c
> @@ -463,8 +463,8 @@ static int vsxxxaa_connect(struct serio *serio, struct serio_driver *drv)
>
> mouse->dev = input_dev;
> mouse->serio = serio;
> - strlcat(mouse->name, "DEC VSXXX-AA/-GA mouse or VSXXX-AB digitizer",
> - sizeof(mouse->name));
> + strscpy(mouse->name, "DEC VSXXX-AA/-GA mouse or VSXXX-AB digitizer",
> + sizeof(mouse->name));
> snprintf(mouse->phys, sizeof(mouse->phys), "%s/input0", serio->phys);
>
> input_dev->name = mouse->name;
> --
> 2.43.0
>
>
--
<https://www.alejandro-colomar.es>
Attachment:
signature.asc
Description: PGP signature