[media] ati_remote: avoid fragile snprintf use
Passing overlapping source and destination to snprintf is fragile. Replace with a single (mostly) equivalent call. If one wants to preserve the space preceding udev->product whether or not there was a manufacturer, just remove udev->manufacturer from the && expression. Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
This commit is contained in:
parent
e57b36c0c4
commit
869f076bd6
@ -873,13 +873,10 @@ static int ati_remote_probe(struct usb_interface *interface,
|
|||||||
strlcat(ati_remote->rc_phys, "/input0", sizeof(ati_remote->rc_phys));
|
strlcat(ati_remote->rc_phys, "/input0", sizeof(ati_remote->rc_phys));
|
||||||
strlcat(ati_remote->mouse_phys, "/input1", sizeof(ati_remote->mouse_phys));
|
strlcat(ati_remote->mouse_phys, "/input1", sizeof(ati_remote->mouse_phys));
|
||||||
|
|
||||||
if (udev->manufacturer)
|
snprintf(ati_remote->rc_name, sizeof(ati_remote->rc_name), "%s%s%s",
|
||||||
strlcpy(ati_remote->rc_name, udev->manufacturer,
|
udev->manufacturer ?: "",
|
||||||
sizeof(ati_remote->rc_name));
|
udev->manufacturer && udev->product ? " " : "",
|
||||||
|
udev->product ?: "");
|
||||||
if (udev->product)
|
|
||||||
snprintf(ati_remote->rc_name, sizeof(ati_remote->rc_name),
|
|
||||||
"%s %s", ati_remote->rc_name, udev->product);
|
|
||||||
|
|
||||||
if (!strlen(ati_remote->rc_name))
|
if (!strlen(ati_remote->rc_name))
|
||||||
snprintf(ati_remote->rc_name, sizeof(ati_remote->rc_name),
|
snprintf(ati_remote->rc_name, sizeof(ati_remote->rc_name),
|
||||||
|
Loading…
Reference in New Issue
Block a user