Skip to content

Conversation

@rlubos
Copy link
Contributor

@rlubos rlubos commented Nov 25, 2025

A few debug logs in TCP code relied on a fact that IP address offset is the same in struct sockaddr_in and sockaddr_in6. However, the logs casted the address to struct sockaddr_in, which is smaller than sockaddr_in6, causing theoretical out-of-bounds access warnings in IPv6 case. Fix this by casting to struct sockaddr_in6 instead.

Fixes #99998

A few debug logs in TCP code relied on a fact that IP address offset is
the same in struct sockaddr_in and sockaddr_in6. However, the logs
casted the address to struct sockaddr_in, which is smaller than
sockaddr_in6, causing theoretical out-of-bounds access warnings in IPv6
case. Fix this by casting to struct sockaddr_in6 instead.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
@sonarqubecloud
Copy link

@carlescufi carlescufi added the Trivial Changes that can be reviewed by anyone, i.e. doc changes, minor build system tweaks, etc. label Nov 25, 2025
@fabiobaltieri fabiobaltieri merged commit 0f9131e into zephyrproject-rtos:main Nov 25, 2025
32 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: Networking Trivial Changes that can be reviewed by anyone, i.e. doc changes, minor build system tweaks, etc.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Coverity CID: 530425] Out-of-bounds access in subsys/net/ip/tcp.c

6 participants