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

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