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

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