Skip to content
Snippets Groups Projects
Commit 56e3b147 authored by Heinrich Schuchardt's avatar Heinrich Schuchardt :speech_balloon: Committed by Tom Rini
Browse files

net: don't memcpy to NULL


In ndisc_receive() 7 bytes are copied from a buffer of size 6 to NULL.

net_nd_packet_mac is a pointer. If it is NULL, we should set it to the
address of the buffer with the MAC address.

Addresses-Coverity-ID: 430974 ("Out-of-bounds access")
Fixes: c6610e1d ("net: ipv6: Add Neighbor Discovery Protocol (NDP)")
Signed-off-by: default avatarHeinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Bin Meng's avatarBin Meng <bmeng.cn@gmail.com>
Reviewed-by: default avatarViacheslav Mitrofanov <v.v.mitrofanov@yadro.com>
parent 0d6d5a4a
No related branches found
No related tags found
No related merge requests found
...@@ -265,7 +265,7 @@ int ndisc_receive(struct ethernet_hdr *et, struct ip6_hdr *ip6, int len) ...@@ -265,7 +265,7 @@ int ndisc_receive(struct ethernet_hdr *et, struct ip6_hdr *ip6, int len)
/* save address for later use */ /* save address for later use */
if (!net_nd_packet_mac) if (!net_nd_packet_mac)
memcpy(net_nd_packet_mac, neigh_eth_addr, 7); net_nd_packet_mac = neigh_eth_addr;
/* modify header, and transmit it */ /* modify header, and transmit it */
memcpy(((struct ethernet_hdr *)net_nd_tx_packet)->et_dest, memcpy(((struct ethernet_hdr *)net_nd_tx_packet)->et_dest,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment