mirror of
https://git.savannah.nongnu.org/git/lwip.git
synced 2025-08-08 23:44:39 +08:00
Fix potential pbuf leaks.
This commit is contained in:
parent
21b5fb5ddb
commit
dbd61d129d
@ -1624,9 +1624,8 @@ static void pppInput(void *arg)
|
|||||||
protocol = ((struct pppInputHeader *)nb->payload)->proto;
|
protocol = ((struct pppInputHeader *)nb->payload)->proto;
|
||||||
|
|
||||||
if(pbuf_header(nb, -(int)sizeof(struct pppInputHeader))) {
|
if(pbuf_header(nb, -(int)sizeof(struct pppInputHeader))) {
|
||||||
/* Can we cope with this failing? Just assert for now */
|
|
||||||
LWIP_ASSERT("pbuf_header failed\n", 0);
|
LWIP_ASSERT("pbuf_header failed\n", 0);
|
||||||
return;
|
goto drop;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if LINK_STATS
|
#if LINK_STATS
|
||||||
@ -1654,10 +1653,8 @@ static void pppInput(void *arg)
|
|||||||
* Clip off the VJ header and prepend the rebuilt TCP/IP header and
|
* Clip off the VJ header and prepend the rebuilt TCP/IP header and
|
||||||
* pass the result to IP.
|
* pass the result to IP.
|
||||||
*/
|
*/
|
||||||
if (vj_uncompress_tcp(&nb, &pppControl[pd].vjComp) >= 0) {
|
if ((vj_uncompress_tcp(&nb, &pppControl[pd].vjComp) >= 0) && (pppControl[pd].netif.input)) {
|
||||||
if (pppControl[pd].netif.input != NULL) {
|
|
||||||
pppControl[pd].netif.input(nb, &pppControl[pd].netif);
|
pppControl[pd].netif.input(nb, &pppControl[pd].netif);
|
||||||
}
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
/* Something's wrong so drop it. */
|
/* Something's wrong so drop it. */
|
||||||
@ -1674,10 +1671,8 @@ static void pppInput(void *arg)
|
|||||||
* Process the TCP/IP header for VJ header compression and then pass
|
* Process the TCP/IP header for VJ header compression and then pass
|
||||||
* the packet to IP.
|
* the packet to IP.
|
||||||
*/
|
*/
|
||||||
if (vj_uncompress_uncomp(nb, &pppControl[pd].vjComp) >= 0) {
|
if ((vj_uncompress_uncomp(nb, &pppControl[pd].vjComp) >= 0) && pppControl[pd].netif.input) {
|
||||||
if (pppControl[pd].netif.input != NULL) {
|
|
||||||
pppControl[pd].netif.input(nb, &pppControl[pd].netif);
|
pppControl[pd].netif.input(nb, &pppControl[pd].netif);
|
||||||
}
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
/* Something's wrong so drop it. */
|
/* Something's wrong so drop it. */
|
||||||
@ -1691,10 +1686,11 @@ static void pppInput(void *arg)
|
|||||||
break;
|
break;
|
||||||
case PPP_IP: /* Internet Protocol */
|
case PPP_IP: /* Internet Protocol */
|
||||||
PPPDEBUG((LOG_INFO, "pppInput[%d]: ip in pbuf len=%d\n", pd, nb->len));
|
PPPDEBUG((LOG_INFO, "pppInput[%d]: ip in pbuf len=%d\n", pd, nb->len));
|
||||||
if (pppControl[pd].netif.input != NULL) {
|
if (pppControl[pd].netif.input) {
|
||||||
pppControl[pd].netif.input(nb, &pppControl[pd].netif);
|
pppControl[pd].netif.input(nb, &pppControl[pd].netif);
|
||||||
}
|
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
struct protent *protp;
|
struct protent *protp;
|
||||||
@ -1715,7 +1711,6 @@ static void pppInput(void *arg)
|
|||||||
/* No handler for this protocol so reject the packet. */
|
/* No handler for this protocol so reject the packet. */
|
||||||
PPPDEBUG((LOG_INFO, "pppInput[%d]: rejecting unsupported proto 0x%04X len=%d\n", pd, protocol, nb->len));
|
PPPDEBUG((LOG_INFO, "pppInput[%d]: rejecting unsupported proto 0x%04X len=%d\n", pd, protocol, nb->len));
|
||||||
if (pbuf_header(nb, sizeof(protocol))) {
|
if (pbuf_header(nb, sizeof(protocol))) {
|
||||||
/* Can we cope with this failing? Just assert for now */
|
|
||||||
LWIP_ASSERT("pbuf_header failed\n", 0);
|
LWIP_ASSERT("pbuf_header failed\n", 0);
|
||||||
goto drop;
|
goto drop;
|
||||||
}
|
}
|
||||||
|
@ -593,7 +593,6 @@ int vj_uncompress_tcp(
|
|||||||
np = pbuf_alloc(PBUF_RAW, n0->len + cs->cs_hlen, PBUF_POOL);
|
np = pbuf_alloc(PBUF_RAW, n0->len + cs->cs_hlen, PBUF_POOL);
|
||||||
if(!np) {
|
if(!np) {
|
||||||
PPPDEBUG((LOG_WARNING, "vj_uncompress_tcp: realign failed\n"));
|
PPPDEBUG((LOG_WARNING, "vj_uncompress_tcp: realign failed\n"));
|
||||||
*nb = NULL;
|
|
||||||
goto bad;
|
goto bad;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -624,7 +623,6 @@ int vj_uncompress_tcp(
|
|||||||
np = pbuf_alloc(PBUF_RAW, cs->cs_hlen, PBUF_POOL);
|
np = pbuf_alloc(PBUF_RAW, cs->cs_hlen, PBUF_POOL);
|
||||||
if(!np) {
|
if(!np) {
|
||||||
PPPDEBUG((LOG_WARNING, "vj_uncompress_tcp: prepend failed\n"));
|
PPPDEBUG((LOG_WARNING, "vj_uncompress_tcp: prepend failed\n"));
|
||||||
*nb = NULL;
|
|
||||||
goto bad;
|
goto bad;
|
||||||
}
|
}
|
||||||
pbuf_cat(np, n0);
|
pbuf_cat(np, n0);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user