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

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