mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2024-11-16 14:11:02 +00:00
Segfault in dhcp_parse_reply if no end marker
If no endmarker is present in a dhcp reply a null pointer is potentially dereferenced. Add fix and test case as proof of concept.
This commit is contained in:
parent
6b3179fbbf
commit
5e224aba6d
@ -1471,8 +1471,14 @@ decode_next:
|
|||||||
if (offset >= q->len) {
|
if (offset >= q->len) {
|
||||||
offset -= q->len;
|
offset -= q->len;
|
||||||
offset_max -= q->len;
|
offset_max -= q->len;
|
||||||
q = q->next;
|
if (offset < offset_max && offset_max) {
|
||||||
options = (u8_t*)q->payload;
|
q = q->next;
|
||||||
|
LWIP_ASSERT("next pbuf was null", q);
|
||||||
|
options = (u8_t*)q->payload;
|
||||||
|
} else {
|
||||||
|
// We've run out of bytes, probably no end marker. Don't proceed.
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* is this an overloaded message? */
|
/* is this an overloaded message? */
|
||||||
|
Loading…
Reference in New Issue
Block a user