From: Alan T. DeKok Date: Sun, 17 Jan 2021 15:19:15 +0000 (-0500) Subject: zero-length attributes are raw, not asserts X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=177519a75fd096648fb1c871ef819dd9617f0807;p=thirdparty%2Ffreeradius-server.git zero-length attributes are raw, not asserts --- diff --git a/src/protocols/dhcpv4/decode.c b/src/protocols/dhcpv4/decode.c index 112c54d4df0..a20b96e6785 100644 --- a/src/protocols/dhcpv4/decode.c +++ b/src/protocols/dhcpv4/decode.c @@ -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; }