Fixed bug #27252: Address pointer invalid after freeing pbuf in UDP receive callback

This commit is contained in:
goldsimon 2009-08-23 11:32:38 +00:00
parent 0e91e2adf2
commit 362a295e06
2 changed files with 7 additions and 1 deletions

View File

@ -25,6 +25,10 @@ HISTORY
++ Bugfixes:
2009-08-23 Simon Goldschmidt
* udp.c: bug #27252: Address pointer invalid after freeing pbuf in UDP
receive callback
2009-08-23 Simon Goldschmidt
* many ppp files: bug #27267: Added include to string.h where needed

View File

@ -281,8 +281,10 @@ udp_input(struct pbuf *p, struct netif *inp)
snmp_inc_udpindatagrams();
/* callback */
if (pcb->recv != NULL) {
/* copy the source address to make it independent of the pbuf */
struct ip_addr src_addr = iphdr->src;
/* now the recv function is responsible for freeing p */
pcb->recv(pcb->recv_arg, pcb, p, &(iphdr->src), src);
pcb->recv(pcb->recv_arg, pcb, p, &src_addr, src);
} else {
/* no recv function registered? then we have to free the pbuf! */
pbuf_free(p);