Message ID | 20230918184631.16228-2-stephen@networkplumber.org (mailing list archive) |
---|---|
State | Accepted |
Commit | e8a3fca81cd4b8fee14cfb14a5ce9c1b3b63e797 |
Delegated to: | Stephen Hemminger |
Headers | show |
Series | [iproute2,1/2] bridge: fix potential snprintf overflow | expand |
Context | Check | Description |
---|---|---|
netdev/tree_selection | success | Not a local patch |
diff --git a/ip/ipila.c b/ip/ipila.c index 4f6d578f24ae..23b19a108862 100644 --- a/ip/ipila.c +++ b/ip/ipila.c @@ -60,6 +60,8 @@ static void print_addr64(__u64 addr, char *buff, size_t len) sep = ""; ret = snprintf(&buff[written], len - written, "%x%s", v, sep); + if (ret < 0 || ret >= len - written) + break; written += ret; } }
The code to print 64 bit address has a theoretical overflow of snprintf buffer found by CodeQL scan. Address by checking result. Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> --- ip/ipila.c | 2 ++ 1 file changed, 2 insertions(+)