Skip to content

Commit

Permalink
dhserver: Fix a potential DoS vulnerability accidentially introduced by
Browse files Browse the repository at this point in the history
  • Loading branch information
kripton committed Feb 4, 2023
1 parent 4c03a9f commit 8308492
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/networking/dhserver.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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])
{
Expand Down

0 comments on commit 8308492

Please sign in to comment.