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

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