summaryrefslogtreecommitdiffstats
path: root/src/udev/udev-builtin-net_id.c
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2022-09-28 11:09:29 +0200
committerYu Watanabe <watanabe.yu+github@gmail.com>2023-08-01 14:34:12 +0200
commit5660e68d651545b43e13a51b068e64022637a6c6 (patch)
treef22f0a1f91644a1b7ff675c572dbd68d29efc996 /src/udev/udev-builtin-net_id.c
parentudev-builtin-net_id: various coding style cleanups (diff)
downloadsystemd-5660e68d651545b43e13a51b068e64022637a6c6.tar.xz
systemd-5660e68d651545b43e13a51b068e64022637a6c6.zip
udev-builtin-net_id: fix potential buffer overflow
Diffstat (limited to '')
-rw-r--r--src/udev/udev-builtin-net_id.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/udev/udev-builtin-net_id.c b/src/udev/udev-builtin-net_id.c
index 4936ba518a..d1f343573d 100644
--- a/src/udev/udev-builtin-net_id.c
+++ b/src/udev/udev-builtin-net_id.c
@@ -948,11 +948,11 @@ static int names_usb(sd_device *dev, NetNames *names) {
/* append USB config number, suppress the common config == 1 */
if (!streq(config, "1"))
- l = strpcpyl(&s, sizeof(names->usb_ports), "c", config, NULL);
+ l = strpcpyl(&s, l, "c", config, NULL);
/* append USB interface number, suppress the interface == 0 */
if (!streq(interf, "0"))
- l = strpcpyl(&s, sizeof(names->usb_ports), "i", interf, NULL);
+ l = strpcpyl(&s, l, "i", interf, NULL);
if (l == 0)
return log_device_debug_errno(dev, SYNTHETIC_ERRNO(ENAMETOOLONG),
"Generated USB name would be too long.");