net: tcp2: Fix the IPv4 endpoint assignment in net_tcp_connect()
Assigning the allocated IPv4 endpoint as struct sockaddr leads to the memory overwrite, assign the correct structure, i.e. struct sockaddr_in. Signed-off-by: Oleg Zhurakivskyy <oleg.zhurakivskyy@intel.com>
This commit is contained in:
parent
762b521931
commit
b6372ea406
1 changed files with 1 additions and 1 deletions
|
@ -1064,7 +1064,7 @@ int net_tcp_connect(struct net_context *context,
|
||||||
ip4 = net_if_ipv4_select_src_addr(net_context_get_iface(context),
|
ip4 = net_if_ipv4_select_src_addr(net_context_get_iface(context),
|
||||||
(struct in_addr *)remote_addr);
|
(struct in_addr *)remote_addr);
|
||||||
conn->src->sin.sin_addr = *ip4;
|
conn->src->sin.sin_addr = *ip4;
|
||||||
conn->dst->sa = *remote_addr;
|
conn->dst->sin.sin_addr = ((struct sockaddr_in *)remote_addr)->sin_addr;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case AF_INET6:
|
case AF_INET6:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue