diff --git a/src/core/ipv4/icmp.c b/src/core/ipv4/icmp.c index 7a0eca39..cf427b27 100644 --- a/src/core/ipv4/icmp.c +++ b/src/core/ipv4/icmp.c @@ -61,7 +61,7 @@ icmp_input(struct pbuf *p, struct netif *inp) iphdr = p->payload; hlen = IPH_HL(iphdr) * 4; - pbuf_header(p, -hlen); + pbuf_header(p, -((s16_t)hlen)); type = *((u8_t *)p->payload); diff --git a/src/core/tcp_in.c b/src/core/tcp_in.c index df3b89a9..1ddaaf7d 100644 --- a/src/core/tcp_in.c +++ b/src/core/tcp_in.c @@ -106,8 +106,8 @@ tcp_input(struct pbuf *p, struct netif *inp) iphdr = p->payload; tcphdr = (struct tcp_hdr *)((u8_t *)p->payload + IPH_HL(iphdr) * 4); - - pbuf_header(p, -(IPH_HL(iphdr) * 4)); + + pbuf_header(p, -((s16_t)(IPH_HL(iphdr) * 4))); /* Don't even process incoming broadcasts/multicasts. */ if(ip_addr_isbroadcast(&(iphdr->dest), &(inp->netmask)) || @@ -116,7 +116,6 @@ tcp_input(struct pbuf *p, struct netif *inp) return; } - /* Verify TCP checksum. */ if(inet_chksum_pseudo(p, (struct ip_addr *)&(iphdr->src), (struct ip_addr *)&(iphdr->dest), diff --git a/src/core/udp.c b/src/core/udp.c index 58774754..aea61330 100644 --- a/src/core/udp.c +++ b/src/core/udp.c @@ -171,7 +171,7 @@ udp_input(struct pbuf *p, struct netif *inp) iphdr = p->payload; - pbuf_header(p, -(UDP_HLEN + IPH_HL(iphdr) * 4)); + pbuf_header(p, -((s16_t)(UDP_HLEN + IPH_HL(iphdr) * 4))); udphdr = (struct udp_hdr *)((u8_t *)p->payload - UDP_HLEN);