From: Yu Watanabe Date: Wed, 28 Sep 2022 09:09:29 +0000 (+0900) Subject: udev-builtin-net_id: fix potential buffer overflow X-Git-Tag: v255-rc1~849^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F28619%2Fhead;p=thirdparty%2Fsystemd.git udev-builtin-net_id: fix potential buffer overflow --- diff --git a/src/udev/udev-builtin-net_id.c b/src/udev/udev-builtin-net_id.c index 4936ba518a0..d1f343573da 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.");