]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
check for message type having length 0
authorAlan T. DeKok <aland@freeradius.org>
Wed, 30 Oct 2019 20:04:36 +0000 (16:04 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Wed, 30 Oct 2019 20:04:36 +0000 (16:04 -0400)
src/protocols/dhcpv4/base.c

index f5086047721d98d920ca013c692141ed374b78a4..7ad382c8e70ee323ef586388aea4b7f86fedb49c 100644 (file)
@@ -242,12 +242,12 @@ bool fr_dhcpv4_ok(uint8_t const *data, ssize_t data_len, uint8_t *message_type,
        }
 
        code = fr_dhcpv4_packet_get_option((dhcp_packet_t const *) data, data_len, attr_dhcp_message_type);
-       if (!code) {
+       if (!code || (code[1] == 0)) {
                fr_strerror_printf("No message-type option was found in the packet");
                return false;
        }
 
-       if ((code[1] < 1) || (code[2] == 0) || (code[2] >= DHCP_MAX_MESSAGE_TYPE)) {
+       if ((code[2] == 0) || (code[2] >= DHCP_MAX_MESSAGE_TYPE)) {
                fr_strerror_printf("Unknown value %d for message-type option", code[2]);
                return false;
        }