From: Alan T. DeKok Date: Sat, 2 Jul 2022 12:19:56 +0000 (-0400) Subject: zero-length strings are allowed to have NULL ptrs X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a49569534534c33bc0dad3505f012767dd241b85;p=thirdparty%2Ffreeradius-server.git zero-length strings are allowed to have NULL ptrs --- diff --git a/src/lib/util/value.c b/src/lib/util/value.c index 4c004a63e95..e8aeee90998 100644 --- a/src/lib/util/value.c +++ b/src/lib/util/value.c @@ -5792,6 +5792,8 @@ DIAG_ON(nonnull-compare) switch (vb->type) { case FR_TYPE_STRING: + if (!vb->vb_length) return; + fr_fatal_assert_msg(vb->vb_strvalue, "CONSISTENCY CHECK FAILED %s[%i]: fr_value_box_t strvalue field " "was NULL", file, line); fr_fatal_assert_msg(vb->vb_strvalue[vb->vb_length] == '\0', @@ -5800,11 +5802,15 @@ DIAG_ON(nonnull-compare) break; case FR_TYPE_OCTETS: + if (!vb->vb_length) return; + fr_fatal_assert_msg(vb->vb_octets, "CONSISTENCY CHECK FAILED %s[%i]: fr_value_box_t octets field " "was NULL", file, line); break; case FR_TYPE_VOID: + if (!vb->vb_length) return; + fr_fatal_assert_msg(vb->vb_void, "CONSISTENCY CHECK FAILED %s[%i]: fr_value_box_t ptr field " "was NULL", file, line); break;