]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
always search to the end of the buffer
authorAlan T. DeKok <aland@freeradius.org>
Wed, 30 Oct 2019 20:09:08 +0000 (16:09 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Wed, 30 Oct 2019 20:09:08 +0000 (16:09 -0400)
src/protocols/dhcpv4/decode.c

index c172d125cd0fe8e0b6ca6185cdafda21207145da..e1d1db33c58b2f787e1ba9b9b19d8789c7590d39 100644 (file)
@@ -111,7 +111,7 @@ static ssize_t decode_value_internal(TALLOC_CTX *ctx, fr_cursor_t *cursor, fr_di
        if (vp->da->type == FR_TYPE_STRING) {
                uint8_t const *q, *end;
 
-               q = end = data + data_len;
+               end = data + data_len;
 
                /*
                 *      Not allowed to be an array, copy the whole value
@@ -123,7 +123,7 @@ static ssize_t decode_value_internal(TALLOC_CTX *ctx, fr_cursor_t *cursor, fr_di
                }
 
                for (;;) {
-                       q = memchr(p, '\0', q - p);
+                       q = memchr(p, '\0', end - p);
 
                        /* Malformed but recoverable */
                        if (!q) q = end;