Skip to content

Commit c9473ca

Browse files
jukkarhenrikbrixandersen
authored andcommitted
net: context: Check null pointer in V6ONLY getsockopt
Make sure we are not accessing NULL pointer when checking if the IPv4 mapping to IPv6 is enabled. Signed-off-by: Jukka Rissanen <[email protected]> (cherry picked from commit cf55290)
1 parent 2cddfce commit c9473ca

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

subsys/net/ip/net_context.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,10 @@ bool net_context_is_reuseport_set(struct net_context *context)
105105
bool net_context_is_v6only_set(struct net_context *context)
106106
{
107107
#if defined(CONFIG_NET_IPV4_MAPPING_TO_IPV6)
108+
if (context == NULL) {
109+
return false;
110+
}
111+
108112
return context->options.ipv6_v6only;
109113
#else
110114
ARG_UNUSED(context);

0 commit comments

Comments
 (0)