gdhcp: Do not process missing DHCP_SERVER_ID fields
PATCH 1/1 gdhcp: Do not process missing DHCP_SERVER_ID fields
The DHCP might send an invalid DHCP response with a missing DHCP_SERVER_ID field. In this case just abort the processing and return to the idle loop.
Reported by Mike Evdokimov.
--- gdhcp/client.c | 5 +++++ 1 file changed, 5 insertions(+)
gdhcp/client.c +5 -0
@@ -2381,6 +2381,9 @@ static gboolean listener_event(GIOChannel *channel, GIOCondition condition, dhcp_client->retry_times =0 ; option =dhcp_get_option (&packet, pkt_len,DHCP_SERVER_ID ); +if (!option) +return TRUE; + dhcp_client->server_ip =get_be32 (option); dhcp_client->requested_ip =ntohl (packet.yiaddr);
@@ -2442,6 +2445,8 @@ static gboolean listener_event(GIOChannel *channel, GIOCondition condition,if (dhcp_client->state ==REBOOTING ) { option =dhcp_get_option (&packet, pkt_len,DHCP_SERVER_ID ); +if (!option) +return TRUE; dhcp_client->server_ip =get_be32 (option); }
Signature · 1 line
2.32.0
Quoted 5 lines · Daniel Wagner
The DHCP might send an invalid DHCP response with a missing
DHCP_SERVER_IDfield. In this case just abort the processing and return to the idle loop.Reported by Mike Evdokimov.
Patch applied.