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]
Date:   Wed,  9 Oct 2019 10:32:32 +0200
From:   Jiri Pirko <jiri@...nulli.us>
To:     netdev@...r.kernel.org
Cc:     dsahern@...il.com, stephen@...workplumber.org, ayal@...lanox.com,
        mlxsw@...lanox.com
Subject: [patch iproute2c] devlink: fix json binary printout of arrays

From: Jiri Pirko <jiri@...lanox.com>

The binary is printed out into json as an array of byte values.
Add missing (removed) start and end array json calls.

Fixes: f359942a25d3 ("devlink: Remove enclosing array brackets binary print with json format")
Signed-off-by: Jiri Pirko <jiri@...lanox.com>
---
 devlink/devlink.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/devlink/devlink.c b/devlink/devlink.c
index 51aba6e200cd..8fc1f3b8b35a 100644
--- a/devlink/devlink.c
+++ b/devlink/devlink.c
@@ -1930,6 +1930,8 @@ static void pr_out_binary_value(struct dl *dl, uint8_t *data, uint32_t len)
 {
 	int i = 0;
 
+	if (dl->json_output)
+		jsonw_start_array(dl->jw);
 	while (i < len) {
 		if (dl->json_output)
 			jsonw_printf(dl->jw, "%d", data[i]);
@@ -1941,6 +1943,8 @@ static void pr_out_binary_value(struct dl *dl, uint8_t *data, uint32_t len)
 	}
 	if (!dl->json_output && !is_binary_eol(i))
 		__pr_out_newline();
+	if (dl->json_output)
+		jsonw_end_array(dl->jw);
 }
 
 static void pr_out_str_value(struct dl *dl, const char *value)
-- 
2.21.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ