diff --git a/mongoose.c b/mongoose.c index 9a842d90..50a27d18 100644 --- a/mongoose.c +++ b/mongoose.c @@ -8816,11 +8816,12 @@ static void rx_ndp_ra(struct mg_tcpip_if *ifp, struct pkt *pkt) { mtu = MG_LOAD_BE32(opts + 4); if (mtu < 1280 || mtu > ifp->l2mtu) mtu = 0; // RFC-8200, minimum MTU } else if (type == 3 && length >= 32) { - // process prefix, 4.6.2 + // process prefix, 4.6.2, ignore if it smells uint8_t pfx_flags = opts[3]; // L=0x80, A=0x40 uint32_t valid = MG_LOAD_BE32(opts + 4); uint32_t pref_lifetime = MG_LOAD_BE32(opts + 8); prefix_len = opts[2]; + if (prefix_len >= 128) break; prefix = opts + 16; // TODO (robertc2000): handle prefix options if necessary diff --git a/src/net_builtin.c b/src/net_builtin.c index 414999e1..24c3acf1 100644 --- a/src/net_builtin.c +++ b/src/net_builtin.c @@ -991,11 +991,12 @@ static void rx_ndp_ra(struct mg_tcpip_if *ifp, struct pkt *pkt) { mtu = MG_LOAD_BE32(opts + 4); if (mtu < 1280 || mtu > ifp->l2mtu) mtu = 0; // RFC-8200, minimum MTU } else if (type == 3 && length >= 32) { - // process prefix, 4.6.2 + // process prefix, 4.6.2, ignore if it smells uint8_t pfx_flags = opts[3]; // L=0x80, A=0x40 uint32_t valid = MG_LOAD_BE32(opts + 4); uint32_t pref_lifetime = MG_LOAD_BE32(opts + 8); prefix_len = opts[2]; + if (prefix_len >= 128) break; prefix = opts + 16; // TODO (robertc2000): handle prefix options if necessary