mirror of
https://git.savannah.nongnu.org/git/lwip.git
synced 2025-08-04 21:44:38 +08:00
PPP, don't assert if we receive a too short packet in ppp_input(), just drop
We might actually receive too short packets through PPPoE or PPPoL2TP, don't assert on unusal packets, just drop them.
This commit is contained in:
parent
5989c1883e
commit
15cc47334e
@ -712,16 +712,17 @@ void ppp_input(ppp_pcb *pcb, struct pbuf *pb) {
|
|||||||
const char *pname;
|
const char *pname;
|
||||||
#endif /* PPP_DEBUG && PPP_PROTOCOLNAME */
|
#endif /* PPP_DEBUG && PPP_PROTOCOLNAME */
|
||||||
|
|
||||||
|
if (pb->len < 2) {
|
||||||
|
PPPDEBUG(LOG_ERR, ("ppp_input[%d]: packet too short\n", pcb->netif->num));
|
||||||
|
goto drop;
|
||||||
|
}
|
||||||
protocol = (((u8_t *)pb->payload)[0] << 8) | ((u8_t*)pb->payload)[1];
|
protocol = (((u8_t *)pb->payload)[0] << 8) | ((u8_t*)pb->payload)[1];
|
||||||
|
|
||||||
#if PRINTPKT_SUPPORT
|
#if PRINTPKT_SUPPORT
|
||||||
ppp_dump_packet("rcvd", (unsigned char *)pb->payload, pb->len);
|
ppp_dump_packet("rcvd", (unsigned char *)pb->payload, pb->len);
|
||||||
#endif /* PRINTPKT_SUPPORT */
|
#endif /* PRINTPKT_SUPPORT */
|
||||||
|
|
||||||
if(pbuf_header(pb, -(s16_t)sizeof(protocol))) {
|
pbuf_header(pb, -(s16_t)sizeof(protocol));
|
||||||
LWIP_ASSERT("pbuf_header failed\n", 0);
|
|
||||||
goto drop;
|
|
||||||
}
|
|
||||||
|
|
||||||
LINK_STATS_INC(link.recv);
|
LINK_STATS_INC(link.recv);
|
||||||
snmp_inc_ifinucastpkts(pcb->netif);
|
snmp_inc_ifinucastpkts(pcb->netif);
|
||||||
@ -901,10 +902,7 @@ void ppp_input(ppp_pcb *pcb, struct pbuf *pb) {
|
|||||||
#endif /* PPP_PROTOCOLNAME */
|
#endif /* PPP_PROTOCOLNAME */
|
||||||
ppp_warn("Unsupported protocol 0x%x received", protocol);
|
ppp_warn("Unsupported protocol 0x%x received", protocol);
|
||||||
#endif /* PPP_DEBUG */
|
#endif /* PPP_DEBUG */
|
||||||
if (pbuf_header(pb, (s16_t)sizeof(protocol))) {
|
pbuf_header(pb, (s16_t)sizeof(protocol));
|
||||||
LWIP_ASSERT("pbuf_header failed\n", 0);
|
|
||||||
goto drop;
|
|
||||||
}
|
|
||||||
lcp_sprotrej(pcb, (u8_t*)pb->payload, pb->len);
|
lcp_sprotrej(pcb, (u8_t*)pb->payload, pb->len);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user