]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
set "next" appropriately, i.e. to the start of the buffer
authorAlan T. DeKok <aland@freeradius.org>
Mon, 18 Nov 2019 22:07:45 +0000 (17:07 -0500)
committerAlan T. DeKok <aland@freeradius.org>
Mon, 18 Nov 2019 23:55:10 +0000 (18:55 -0500)
src/protocols/dhcpv6/decode.c

index 5c2ccbd28876556fb3da483650d8bd388e794e19..79cfcfdd14eb507676b5e76098011285f39d0846 100644 (file)
@@ -267,7 +267,7 @@ static ssize_t decode_dns_labels(TALLOC_CTX *ctx, fr_cursor_t *cursor, fr_dict_t
        ssize_t rcode;
        size_t total;
        VALUE_PAIR *vp;
-       uint8_t const *next;
+       uint8_t const *next = data;
 
        FR_PROTO_HEX_DUMP(data, data_len, "decode_dns_labels");
 
@@ -277,10 +277,12 @@ static ssize_t decode_dns_labels(TALLOC_CTX *ctx, fr_cursor_t *cursor, fr_dict_t
         */
        if (!parent->flags.array) {
                rcode = fr_dns_label_length(data, data_len, &next);
-               if (rcode < 0) goto raw;
+               if (rcode <= 0) goto raw;
 
                /*
                 *      If the DNS label doesn't exactly fill the option, it's an error.
+                *
+                *      @todo - we may want to remove this check.
                 */
                if (next != (data + data_len)) goto raw;