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

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