Blame SOURCES/0167-print_ifindex-fix-IFNAME_QUOTED_SZ-definition.patch

e5c382
From e27b06773eaf5c0307bcc5637d7457be9be1e6ea Mon Sep 17 00:00:00 2001
e5c382
From: Eugene Syromyatnikov <evgsyr@gmail.com>
e5c382
Date: Wed, 1 Dec 2021 17:11:02 +0100
e5c382
Subject: [PATCH] print_ifindex: fix IFNAME_QUOTED_SZ definition
e5c382
e5c382
sizeof(IFNAMSIZ) instead of IFNAMSIZ was mistakenly used
e5c382
for IFNAME_QUOTED_SZ initial definition in commit v4.23~87
e5c382
"print_ifindex: respect xlat style settings".
e5c382
e5c382
* src/print_ifindex.c (IFNAME_QUOTED_SZ): Use IFNAMSIZ
e5c382
instead of sizeof(IFNAMSIZ).
e5c382
* NEWS: Mention it.
e5c382
e5c382
Reported-by: Paulo Andrade <pandrade@redhat.com>
e5c382
Suggested-by: Paulo Andrade <pandrade@redhat.com>
e5c382
Fixes: v4.23~87 "print_ifindex: respect xlat style settings"
e5c382
References: https://bugzilla.redhat.com/show_bug.cgi?id=2028146
e5c382
---
e5c382
 NEWS                | 4 ++++
e5c382
 src/print_ifindex.c | 2 +-
e5c382
 2 files changed, 5 insertions(+), 1 deletion(-)
e5c382
e5c382
diff --git a/NEWS b/NEWS
e5c382
index 9bab673..a3036b8 100644
e5c382
--- a/NEWS
e5c382
+++ b/NEWS
e5c382
@@ -16,6 +16,12 @@ Noteworthy changes in release ?.?? (????-??-??)
e5c382
     PTRACE_*, RTM_*, RTPROT_*, TRAP_*, UFFD_*, UFFDIO_*, and V4L2_* constants.
e5c382
   * Updated lists of ioctl commands from Linux 5.13.
e5c382
 
e5c382
+ * Bug fixes
e5c382
+  * Fixed insufficient buffer size used for network interface name printing,
e5c382
+    that previously led to assertions on attempts of printing interface names
e5c382
+    that require quoting, for example, names longer than 4 characters in -xx
e5c382
+    mode (addresses RHBZ bug #2028146).
e5c382
+
e5c382
 * Portability
e5c382
   * On powerpc and powerpc64, linux kernel >= 2.6.23 is required.
e5c382
     Older versions without a decent PTRACE_GETREGS support will not work.
e5c382
diff --git a/src/print_ifindex.c b/src/print_ifindex.c
e5c382
index ec48093..dc9d592 100644
e5c382
--- a/src/print_ifindex.c
e5c382
+++ b/src/print_ifindex.c
e5c382
@@ -13,7 +13,7 @@
e5c382
 
e5c382
 # define INI_PFX "if_nametoindex(\""
e5c382
 # define INI_SFX "\")"
e5c382
-# define IFNAME_QUOTED_SZ (sizeof(IFNAMSIZ) * 4 + 3)
e5c382
+# define IFNAME_QUOTED_SZ (IFNAMSIZ * 4 + 3)
e5c382
 
e5c382
 const char *
e5c382
 get_ifname(const unsigned int ifindex)
e5c382
-- 
e5c382
2.1.4
e5c382