Skip to content

Commit 8308492

Browse files
committed
dhserver: Fix a potential DoS vulnerability accidentially introduced by hathach#1712
1 parent 4c03a9f commit 8308492

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

lib/networking/dhserver.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ typedef struct
8686
uint8_t dp_giaddr[4]; /* gateway IP address */
8787
uint8_t dp_chaddr[16]; /* client hardware address */
8888
uint8_t dp_legacy[192];
89-
uint8_t dp_magic[4];
89+
uint8_t dp_magic[4];
9090
uint8_t dp_options[275]; /* options area */
9191
} DHCP_TYPE;
9292

@@ -242,7 +242,11 @@ static void udp_recv_proc(void *arg, struct udp_pcb *upcb, struct pbuf *p, const
242242
memcpy(&dhcp_data, p->payload, n);
243243

244244
ptr = find_dhcp_option(dhcp_data.dp_options, sizeof(dhcp_data.dp_options), DHCP_MESSAGETYPE);
245-
if (ptr == NULL) return;
245+
if (ptr == NULL)
246+
{
247+
pbuf_free(p);
248+
return;
249+
}
246250

247251
switch (ptr[2])
248252
{

0 commit comments

Comments
 (0)