Netdev List
 help / color / mirror / Atom feed
* [PATCH iproute2] lib: do not truncate 64 bit size in json
@ 2026-11-09 18:08 Stephen Hemminger
  2026-11-11  0:00 ` patchwork-bot+netdevbpf
  0 siblings, 1 reply; 2+ messages in thread
From: Stephen Hemminger @ 2026-11-09 18:08 UTC (permalink / raw)
  To: netdev; +Cc: dsahern, Stephen Hemminger

print_color_size() takes a 64 bit size but it gets truncated
when printing json.

Reported-by: Anthropic OSS scanner (ANT-2026-H0R4ZJSS)
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 lib/json_print_math.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lib/json_print_math.c b/lib/json_print_math.c
index 3e951cd9..85c29d6c 100644
--- a/lib/json_print_math.c
+++ b/lib/json_print_math.c
@@ -1,6 +1,7 @@
 // SPDX-License-Identifier: GPL-2.0+
 
 #include <stdarg.h>
+#include <inttypes.h>
 #include <stdio.h>
 #include <math.h>
 
@@ -33,7 +34,7 @@ int print_color_size(enum output_type type, enum color_attr color,
 	SPRINT_BUF(buf);
 
 	if (_IS_JSON_CONTEXT(type))
-		return print_color_uint(type, color, key, "%u", sz);
+		return print_color_u64(type, color, key, "%"PRIu64, sz);
 
 	sprint_size(sz, buf);
 	return print_color_string(type, color, key, fmt, buf);
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-11-11  0:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-09 18:08 [PATCH iproute2] lib: do not truncate 64 bit size in json Stephen Hemminger
2026-11-11  0:00 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox