mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2024-12-25 18:14:53 +00:00
PPP: check that pbuf_coalesce succeed
When pbuf_coalesce fails it does nothing and returns the previous buffer chain. Adds checks that pbuf_coalesce succeeded, otherwise drop incoming packet.
This commit is contained in:
parent
7c0c3879b2
commit
5bf9cebb54
@ -930,6 +930,10 @@ void ppp_input(ppp_pcb *pcb, struct pbuf *pb) {
|
||||
for (i = 0; (protp = protocols[i]) != NULL; ++i) {
|
||||
if (protp->protocol == protocol) {
|
||||
pb = pbuf_coalesce(pb, PBUF_RAW);
|
||||
if (pb->next != NULL) {
|
||||
PPPDEBUG(LOG_WARNING, ("ppp_input[%d]: Dropping (pbuf_coalesce failed), len=%d\n", pcb->netif->num, pb->tot_len));
|
||||
goto drop;
|
||||
}
|
||||
(*protp->input)(pcb, (u8_t*)pb->payload, pb->len);
|
||||
goto out;
|
||||
}
|
||||
|
@ -410,6 +410,10 @@ pppoe_disc_input(struct netif *netif, struct pbuf *pb)
|
||||
}
|
||||
|
||||
pb = pbuf_coalesce(pb, PBUF_RAW);
|
||||
if (pb->next != NULL) {
|
||||
PPPDEBUG(LOG_DEBUG, ("pppoe: pbuf_coalesce failed: %d\n", pb->tot_len));
|
||||
goto done;
|
||||
}
|
||||
|
||||
ethhdr = (struct eth_hdr *)pb->payload;
|
||||
|
||||
|
@ -530,6 +530,11 @@ static void pppol2tp_dispatch_control_packet(pppol2tp_pcb *l2tp, u16_t port, str
|
||||
l2tp->peer_ns = ns+1;
|
||||
|
||||
p = pbuf_coalesce(p, PBUF_RAW);
|
||||
if (p->next != NULL) {
|
||||
PPPDEBUG(LOG_DEBUG, ("pppol2tp: pbuf_coalesce failed: %d\n", p->tot_len));
|
||||
return;
|
||||
}
|
||||
|
||||
inp = (u8_t*)p->payload;
|
||||
/* Decode AVPs */
|
||||
while (p->len > 0) {
|
||||
|
Loading…
Reference in New Issue
Block a user