Blob Blame History Raw
From e27b06773eaf5c0307bcc5637d7457be9be1e6ea Mon Sep 17 00:00:00 2001
From: Eugene Syromyatnikov <evgsyr@gmail.com>
Date: Wed, 1 Dec 2021 17:11:02 +0100
Subject: [PATCH] print_ifindex: fix IFNAME_QUOTED_SZ definition

sizeof(IFNAMSIZ) instead of IFNAMSIZ was mistakenly used
for IFNAME_QUOTED_SZ initial definition in commit v4.23~87
"print_ifindex: respect xlat style settings".

* src/print_ifindex.c (IFNAME_QUOTED_SZ): Use IFNAMSIZ
instead of sizeof(IFNAMSIZ).
* NEWS: Mention it.

Reported-by: Paulo Andrade <pandrade@redhat.com>
Suggested-by: Paulo Andrade <pandrade@redhat.com>
Fixes: v4.23~87 "print_ifindex: respect xlat style settings"
References: https://bugzilla.redhat.com/show_bug.cgi?id=2028146
---
 NEWS                | 4 ++++
 src/print_ifindex.c | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)

Index: strace-4.24/NEWS
===================================================================
--- strace-4.24.orig/NEWS	2022-01-06 16:40:29.277122809 +0100
+++ strace-4.24/NEWS	2022-01-06 16:41:02.803843038 +0100
@@ -21,6 +21,10 @@
   * Fixed build in exotic systemd-nspawn based environments.
   * Fixed build on s390 with kernel headers that do not contain Linux commit
     v3.10-rc1~201^2~11.
+  * Fixed insufficient buffer size used for network interface name printing,
+    that previously led to assertions on attempts of printing interface names
+    that require quoting, for example, names longer than 4 characters in -xx
+    mode (addresses RHBZ bug #2028146).
 
 Noteworthy changes in release 4.23 (2018-06-14)
 ===============================================
Index: strace-4.24/print_ifindex.c
===================================================================
--- strace-4.24.orig/print_ifindex.c	2022-01-06 16:40:48.594961607 +0100
+++ strace-4.24/print_ifindex.c	2022-01-06 16:41:10.107782089 +0100
@@ -13,7 +13,7 @@
 
 # define INI_PFX "if_nametoindex("
 # define INI_SFX ")"
-# define IFNAME_QUOTED_SZ (sizeof(IFNAMSIZ) * 4 + 3)
+# define IFNAME_QUOTED_SZ (IFNAMSIZ * 4 + 3)
 
 static const char *
 get_ifname(const unsigned int ifindex)