All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: netdev@vger.kernel.org
Cc: dsahern@kernel.org, Stephen Hemminger <stephen@networkplumber.org>
Subject: [PATCH iproute2] lib: do not truncate 64 bit size in json
Date: Mon,  9 Nov 2026 10:08:46 -0800	[thread overview]
Message-ID: <20261109180846.301249-1-stephen@networkplumber.org> (raw)

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


             reply	other threads:[~2026-11-09 18:08 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-09 18:08 Stephen Hemminger [this message]
2026-11-11  0:00 ` [PATCH iproute2] lib: do not truncate 64 bit size in json patchwork-bot+netdevbpf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261109180846.301249-1-stephen@networkplumber.org \
    --to=stephen@networkplumber.org \
    --cc=dsahern@kernel.org \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.