mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2024-10-01 04:12:07 +00:00
fixed bug #38066 Raw pcbs can alter packet without eating it: added assertion to check that p->payload is unchanged
This commit is contained in:
parent
d237ec7e78
commit
769b2a3e30
@ -80,6 +80,9 @@ HISTORY
|
|||||||
|
|
||||||
++ Bugfixes:
|
++ Bugfixes:
|
||||||
|
|
||||||
|
2013-01-11: Simon Goldschmidt
|
||||||
|
* raw.c: fixed bug #38066 Raw pcbs can alter packet without eating it
|
||||||
|
|
||||||
2012-09-26: Simon Goldschmidt
|
2012-09-26: Simon Goldschmidt
|
||||||
* api_msg.c: fixed bug #37405 'err_tcp()' uses already freed 'netconn' object
|
* api_msg.c: fixed bug #37405 'err_tcp()' uses already freed 'netconn' object
|
||||||
|
|
||||||
|
@ -119,6 +119,9 @@ raw_input(struct pbuf *p, struct netif *inp)
|
|||||||
{
|
{
|
||||||
/* receive callback function available? */
|
/* receive callback function available? */
|
||||||
if (pcb->recv.ip4 != NULL) {
|
if (pcb->recv.ip4 != NULL) {
|
||||||
|
#ifndef LWIP_NOASSERT
|
||||||
|
void* old_payload = p->payload;
|
||||||
|
#endif
|
||||||
/* the receive callback function did not eat the packet? */
|
/* the receive callback function did not eat the packet? */
|
||||||
eaten = pcb->recv.ip4(pcb->recv_arg, pcb, p, ip_current_src_addr());
|
eaten = pcb->recv.ip4(pcb->recv_arg, pcb, p, ip_current_src_addr());
|
||||||
if (eaten != 0) {
|
if (eaten != 0) {
|
||||||
@ -132,6 +135,10 @@ raw_input(struct pbuf *p, struct netif *inp)
|
|||||||
pcb->next = raw_pcbs;
|
pcb->next = raw_pcbs;
|
||||||
raw_pcbs = pcb;
|
raw_pcbs = pcb;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
/* sanity-check that the receive callback did not alter the pbuf */
|
||||||
|
LWIP_ASSERT("raw pcb recv callback altered pbuf payload pointer without eating packet",
|
||||||
|
p->payload == old_payload);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* no receive callback function was set for this raw PCB */
|
/* no receive callback function was set for this raw PCB */
|
||||||
|
Loading…
Reference in New Issue
Block a user