mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2024-11-04 14:29:39 +00:00
udp_input(): Input pbuf was not freed if pcb had no recv function registered, p->payload was modified without modifying p->len if sending icmp_dest_unreach() (had no negative effect but was definitively wrong).
This commit is contained in:
parent
75fd6fc4a4
commit
974cf08e5d
@ -170,6 +170,11 @@ HISTORY
|
||||
|
||||
++ Bug fixes:
|
||||
|
||||
2007-06-03 Simon Goldschmidt
|
||||
* udp.c: udp_input(): Input pbuf was not freed if pcb had no recv function
|
||||
registered, p->payload was modified without modifying p->len if sending
|
||||
icmp_dest_unreach() (had no negative effect but was definitively wrong).
|
||||
|
||||
2007-06-03 Simon Goldschmidt
|
||||
* icmp.c: Corrected bug #19937: For responding to an icmp echo request, icmp
|
||||
re-used the input pbuf even if that didn't have enough space to include the
|
||||
|
@ -214,8 +214,14 @@ udp_input(struct pbuf *p, struct netif *inp)
|
||||
if (pcb != NULL) {
|
||||
snmp_inc_udpindatagrams();
|
||||
/* callback */
|
||||
if (pcb->recv != NULL)
|
||||
if (pcb->recv != NULL) {
|
||||
/* now the recv function is responsible for freeing p */
|
||||
pcb->recv(pcb->recv_arg, pcb, p, &(iphdr->src), src);
|
||||
} else {
|
||||
/* no recv function registered? then we have to free the pbuf! */
|
||||
pbuf_free(p);
|
||||
goto end;
|
||||
}
|
||||
} else {
|
||||
LWIP_DEBUGF(UDP_DEBUG | LWIP_DBG_TRACE, ("udp_input: not for us.\n"));
|
||||
|
||||
@ -226,7 +232,8 @@ udp_input(struct pbuf *p, struct netif *inp)
|
||||
!ip_addr_ismulticast(&iphdr->dest)) {
|
||||
|
||||
/* restore pbuf pointer */
|
||||
p->payload = iphdr;
|
||||
pbuf_header(p, (IPH_HL(iphdr) * 4));
|
||||
LWIP_ASSERT("p->payload == iphdr", (p->payload == iphdr));
|
||||
icmp_dest_unreach(p, ICMP_DUR_PORT);
|
||||
}
|
||||
UDP_STATS_INC(udp.proterr);
|
||||
|
Loading…
Reference in New Issue
Block a user