]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
zero-length attributes are raw, not asserts
authorAlan T. DeKok <aland@freeradius.org>
Sun, 17 Jan 2021 15:19:15 +0000 (10:19 -0500)
committerAlan T. DeKok <aland@freeradius.org>
Sun, 17 Jan 2021 15:19:15 +0000 (10:19 -0500)
src/protocols/dhcpv4/decode.c

index 112c54d4df056b1e1c66dff88e3c3d6ee4f84d7c..a20b96e6785b2279978adeef7887adb41d93c985 100644 (file)
@@ -85,8 +85,12 @@ static ssize_t decode_value_internal(TALLOC_CTX *ctx, fr_cursor_t *cursor, fr_di
        vp = fr_pair_afrom_da(ctx, da);
        if (!vp) return -1;
 
+       /*
+        *      string / octets can be empty.  Other data types are
+        *      incorrect if they're empty.
+        */
        if (data_len == 0) {
-               fr_assert((da->type == FR_TYPE_OCTETS) || (da->type == FR_TYPE_STRING));
+               if (!((da->type == FR_TYPE_OCTETS) || (da->type == FR_TYPE_STRING))) goto raw;
                goto finish;
        }