From: Maks Mishin <maks.mishinfz@gmail.com>
To: Stephen Hemminger <stephen@networkplumber.org>
Cc: Maks Mishin <maks.mishinFZ@gmail.com>, netdev@vger.kernel.org
Subject: [PATCH] q_tbf: Fix potential static-overflow in tbf_print_opt
Date: Sun, 7 Jul 2024 20:55:38 +0300 [thread overview]
Message-ID: <20240707175538.1245-1-maks.mishinFZ@gmail.com> (raw)
An element of array '&b1[0]' of size 64, declared at q_tbf.c:257,
is accessed by an index with values in [0, 74] at q_tbf.c:279,
which may lead to a buffer overflow.
Details: Format string: '%s/%u'. Size of buffer parameter is 63;
Specifier '%u': min value '-2147483647' requires 10 character(s),
max value '2147483647' requires 10 character(s), so the buffer needs
enough space to receive 10 character(s).
Size of the string except for specifiers is 1; Total maximum size is 74.
Found by RASU JSC.
Signed-off-by: Maks Mishin <maks.mishinFZ@gmail.com>
---
tc/q_tbf.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tc/q_tbf.c b/tc/q_tbf.c
index 9356dfd2..b9f4191c 100644
--- a/tc/q_tbf.c
+++ b/tc/q_tbf.c
@@ -254,7 +254,7 @@ static int tbf_print_opt(const struct qdisc_util *qu, FILE *f, struct rtattr *op
double latency, lat2;
__u64 rate64 = 0, prate64 = 0;
- SPRINT_BUF(b1);
+ char b1[74];
SPRINT_BUF(b2);
SPRINT_BUF(b3);
--
2.30.2
next reply other threads:[~2024-07-07 17:55 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-07 17:55 Maks Mishin [this message]
2024-07-10 23:08 ` [PATCH] q_tbf: Fix potential static-overflow in tbf_print_opt Stephen Hemminger
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=20240707175538.1245-1-maks.mishinFZ@gmail.com \
--to=maks.mishinfz@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=stephen@networkplumber.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).