diff options
| author | Ha Thach <[email protected]> | 2023-02-13 15:11:44 +0700 |
|---|---|---|
| committer | GitHub <[email protected]> | 2023-02-13 15:11:44 +0700 |
| commit | 09e70ebd137e76b95fb0ff39b07fa47769f8ec42 (patch) | |
| tree | 3dfccf1395371965cb6de09b768dc0c2652481bb /lib | |
| parent | ac60a03ea96ecafa326499278048e2c0e0008d02 (diff) | |
| parent | 830849211d866fcafef555269b1376f15802cc68 (diff) | |
Merge pull request #1885 from kripton/fixDHCPServerDoS
dhserver: Fix a potential DoS vulnerability accidentially introduced by #1712
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/networking/dhserver.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/networking/dhserver.c b/lib/networking/dhserver.c index def431f75..8cd22ddb9 100644 --- a/lib/networking/dhserver.c +++ b/lib/networking/dhserver.c @@ -86,7 +86,7 @@ typedef struct uint8_t dp_giaddr[4]; /* gateway IP address */ uint8_t dp_chaddr[16]; /* client hardware address */ uint8_t dp_legacy[192]; - uint8_t dp_magic[4]; + uint8_t dp_magic[4]; uint8_t dp_options[275]; /* options area */ } DHCP_TYPE; @@ -242,7 +242,11 @@ static void udp_recv_proc(void *arg, struct udp_pcb *upcb, struct pbuf *p, const memcpy(&dhcp_data, p->payload, n); ptr = find_dhcp_option(dhcp_data.dp_options, sizeof(dhcp_data.dp_options), DHCP_MESSAGETYPE); - if (ptr == NULL) return; + if (ptr == NULL) + { + pbuf_free(p); + return; + } switch (ptr[2]) { |
