From 1432496fc9bba900a2e25b3b9ebc1e48dfd2bc51 Mon Sep 17 00:00:00 2001 From: billwatersiii <65681039+billwatersiii@users.noreply.github.com> Date: Wed, 6 Oct 2021 07:32:13 -0700 Subject: [PATCH] fix for malformed IPv6 Network Solicitation packet (#10160) --- third_party/lwip/repo/lwip/src/core/ipv6/nd6.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/third_party/lwip/repo/lwip/src/core/ipv6/nd6.c b/third_party/lwip/repo/lwip/src/core/ipv6/nd6.c index c085d32d4defd2..4e2718544458fd 100644 --- a/third_party/lwip/repo/lwip/src/core/ipv6/nd6.c +++ b/third_party/lwip/repo/lwip/src/core/ipv6/nd6.c @@ -1111,8 +1111,8 @@ nd6_send_ns(struct netif *netif, const ip6_addr_t *target_addr, u8_t flags) } /* Allocate a packet. */ - p = pbuf_alloc(PBUF_IP, sizeof(struct ns_header) + ND6_LLADDR_OPTION_SIZE(netif->hwaddr_len), PBUF_RAM); - if ((p == NULL) || (p->len < (sizeof(struct ns_header) + ND6_LLADDR_OPTION_SIZE(netif->hwaddr_len)))) { + p = pbuf_alloc(PBUF_IP, sizeof(struct ns_header) + (lladdr_opt_len << 3), PBUF_RAM); + if ((p == NULL) || (p->len < (sizeof(struct ns_header) + (lladdr_opt_len << 3)))) { /* We couldn't allocate a suitable pbuf for the ns. drop it. */ if (p != NULL) { pbuf_free(p);