From f091d59e0f9abec9304d9d230fafc2dec001baba Mon Sep 17 00:00:00 2001 From: Holger Weiss Date: Wed, 13 Jun 2012 12:36:42 +0200 Subject: check_dhcp: Fix handling of "pad" options Don't let "pad" options[*] terminate the parsing of DHCP options. This bug was triggered by using check_dhcp against Windows 2003 DHCP servers (see #3503921). [*] Cf. RFC 2132, 3.1. --- plugins-root/check_dhcp.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'plugins-root') diff --git a/plugins-root/check_dhcp.c b/plugins-root/check_dhcp.c index 2a1875c4..ac892747 100644 --- a/plugins-root/check_dhcp.c +++ b/plugins-root/check_dhcp.c @@ -839,8 +839,7 @@ int add_dhcp_offer(struct in_addr source,dhcp_packet *offer_packet){ /* process all DHCP options present in the packet */ for(x=4;xoptions[x]==-1 || (int)offer_packet->options[x]==0) + if((int)offer_packet->options[x]==-1) break; /* get option type */ @@ -872,7 +871,9 @@ int add_dhcp_offer(struct in_addr source,dhcp_packet *offer_packet){ } /* skip option data we're ignoring */ - if(option_type!=DHCP_OPTION_REBINDING_TIME) + if(option_type==0) /* "pad" option, see RFC 2132 (3.1) */ + x+=1; + else x+=option_length; } -- cgit v1.2.3