mirror of
https://github.com/cesanta/mongoose.git
synced 2026-11-19 19:40:56 +00:00
Fix oob read in rx_dhcp()
This commit is contained in:
1 parent
f9ad870ff0
commit
cb5034548d
2 files changed
+3
-5
No files matched your search
@@ -462,7 +462,7 @@ static void rx_dhcp(struct mip_if *ifp, struct pkt *pkt) {
|
||||
uint8_t *p = pkt->dhcp->options, *end = &pkt->raw.buf[pkt->raw.len];
|
||||
if (end < (uint8_t *) (pkt->dhcp + 1)) return;
|
||||
// MG_DEBUG(("DHCP %u", (unsigned) pkt->raw.len));
|
||||
while (p < end && p[0] != 255) {
|
||||
while (p + 1 < end && p[0] != 255) {
|
||||
if (p[0] == 1 && p[1] == sizeof(ifp->mask)) {
|
||||
memcpy(&mask, p + 2, sizeof(mask));
|
||||
// MG_DEBUG(("MASK %x", mask));
|
||||
|
||||
Reference in new issue
Block a user