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-next>] [day] [month] [year] [list]
Message-Id: <20240213204009.13625-1-maks.mishinFZ@gmail.com>
Date: Tue, 13 Feb 2024 23:40:09 +0300
From: Maks Mishin <maks.mishinfz@...il.com>
To: Stephen Hemminger <stephen@...workplumber.org>
Cc: Maks Mishin <maks.mishinFZ@...il.com>,
	netdev@...r.kernel.org
Subject: [PATCH] json_print: Add explicit condition in print_color_string()

Added explicit condition for check `key` and `value`
in print_color_string() to avoid call `jsonw_string_field`
with key=NULL and value=NULL.

Signed-off-by: Maks Mishin <maks.mishinFZ@...il.com>
---
 lib/json_print.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/json_print.c b/lib/json_print.c
index 810d496e..a264614c 100644
--- a/lib/json_print.c
+++ b/lib/json_print.c
@@ -170,7 +170,7 @@ int print_color_string(enum output_type type,
 			jsonw_name(_jw, key);
 		else if (!key && value)
 			jsonw_string(_jw, value);
-		else
+		else if (key && value)
 			jsonw_string_field(_jw, key, value);
 	} else if (_IS_FP_CONTEXT(type)) {
 		ret = color_fprintf(stdout, color, fmt, value);
-- 
2.30.2


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ