From 90f2e0ad8651fef84c4a1fe99a66d1a4f43b941d Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Wed, 28 Sep 2022 18:09:29 +0900 Subject: [PATCH] udev-builtin-net_id: fix potential buffer overflow (cherry picked from commit 5660e68d651545b43e13a51b068e64022637a6c6) (cherry picked from commit a987b0f12133bcb5ab73000109468871bfbab3c2) (cherry picked from commit 22bd243c808d27b6b7725465ebcb21fac72020a8) Conflict:code context adaptation Reference:https://github.com/systemd/systemd-stable/commit/90f2e0ad8651fef84c4a1fe99a66d1a4f43b941d --- src/udev/udev-builtin-net_id.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/udev/udev-builtin-net_id.c b/src/udev/udev-builtin-net_id.c index d4e9dcb60d..6425494f9c 100644 --- a/src/udev/udev-builtin-net_id.c +++ b/src/udev/udev-builtin-net_id.c @@ -804,11 +804,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 -ENAMETOOLONG; -- 2.33.0