lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240122210546.3423784-2-pctammela@mojatatu.com>
Date: Mon, 22 Jan 2024 18:05:45 -0300
From: Pedro Tammela <pctammela@...atatu.com>
To: netdev@...r.kernel.org
Cc: Pedro Tammela <pctammela@...atatu.com>
Subject: [PATCH iproute2 1/2] color: use empty format string instead of NULL in vfprintf

NULL is passed in the format string when nothing is to be printed.
This is commonly done in the print_bool function when a flag is false.
Glibc seems to handle this case nicely but for musl it will cause a
segmentation fault.

The following is an example of one crash in musl based systems/containers:
   tc qdisc add dev dummy0 handle 1: root choke limit 1000 bandwidth 10000
   tc qdisc replace dev dummy0 handle 1: root choke limit 1000 bandwidth 10000 min 100
   tc qdisc show dev dummy0

Signed-off-by: Pedro Tammela <pctammela@...atatu.com>
---
 lib/color.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/color.c b/lib/color.c
index 59976847..027e1703 100644
--- a/lib/color.c
+++ b/lib/color.c
@@ -143,7 +143,7 @@ int color_fprintf(FILE *fp, enum color_attr attr, const char *fmt, ...)
 	va_start(args, fmt);
 
 	if (!color_is_enabled || attr == COLOR_NONE) {
-		ret = vfprintf(fp, fmt, args);
+		ret = vfprintf(fp, fmt ?: "", args);
 		goto end;
 	}
 
-- 
2.40.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ