From 0616c2679b5c71eb5ab292161ef4f6e9ed23eac7 Mon Sep 17 00:00:00 2001 From: Jaakko Hannikainen Date: Mon, 27 Jun 2016 11:30:04 +0300 Subject: [PATCH] net: initialize ip_buf_len when receiving packet When udp_packet_receive is called, ip_buf_len is set 4 bytes too big. This ends up with the client program receiving 4 bytes more than the board actually received. Initialize it correctly alongside other values. Change-Id: I0012aa7e8c6a440a618dfa03c4fdc2b898d592fc Signed-off-by: Jaakko Hannikainen --- net/ip/net_core.c | 1 + 1 file changed, 1 insertion(+) diff --git a/net/ip/net_core.c b/net/ip/net_core.c index cadf310530d..32a292d17f5 100644 --- a/net/ip/net_core.c +++ b/net/ip/net_core.c @@ -575,6 +575,7 @@ static void udp_packet_receive(struct simple_udp_connection *c, ip_buf_appdatalen(buf) = datalen; ip_buf_appdata(buf) = &uip_buf(buf)[UIP_IPUDPH_LEN + UIP_LLH_LEN]; + ip_buf_len(buf) = datalen + UIP_IPUDPH_LEN + UIP_LLH_LEN; NET_DBG("packet received context %p len %d " "appdata %p appdatalen %d\n",