mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2024-11-04 23:29:25 +00:00
Added 2 asserts in pbuf_realloc to prevent dereferencing a null pointer in invalid pbuf queues
This commit is contained in:
parent
c779a9f29f
commit
6374766a55
@ -272,6 +272,7 @@ pbuf_realloc(struct pbuf *p, u16_t new_len)
|
||||
u16_t rem_len; /* remaining length */
|
||||
s32_t grow;
|
||||
|
||||
LWIP_ASSERT("pbuf_realloc: p != NULL", p != NULL);
|
||||
LWIP_ASSERT("pbuf_realloc: sane p->type", p->type == PBUF_POOL ||
|
||||
p->type == PBUF_ROM ||
|
||||
p->type == PBUF_RAM ||
|
||||
@ -299,6 +300,7 @@ pbuf_realloc(struct pbuf *p, u16_t new_len)
|
||||
q->tot_len += (u16_t)grow;
|
||||
/* proceed to next pbuf in chain */
|
||||
q = q->next;
|
||||
LWIP_ASSERT("pbuf_realloc: q != NULL", q != NULL);
|
||||
}
|
||||
/* we have now reached the new last pbuf (in q) */
|
||||
/* rem_len == desired length for pbuf q */
|
||||
|
Loading…
Reference in New Issue
Block a user