From: Alan T. DeKok Date: Mon, 11 Jul 2022 15:44:23 +0000 (-0400) Subject: don't create value-boxes with NULL ptrs for 'octets' X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cc02e7fdcf8e76fc899099065d1f0d8ca636153f;p=thirdparty%2Ffreeradius-server.git don't create value-boxes with NULL ptrs for 'octets' --- diff --git a/src/lib/util/value.c b/src/lib/util/value.c index 8911064ea5b..b92ac0d564f 100644 --- a/src/lib/util/value.c +++ b/src/lib/util/value.c @@ -3550,7 +3550,7 @@ int fr_value_box_copy(TALLOC_CTX *ctx, fr_value_box_t *dst, const fr_value_box_t case FR_TYPE_OCTETS: { - uint8_t *bin = NULL; + uint8_t *bin; if (src->vb_length) { bin = talloc_memdup(ctx, src->vb_octets, src->vb_length); @@ -3559,6 +3559,8 @@ int fr_value_box_copy(TALLOC_CTX *ctx, fr_value_box_t *dst, const fr_value_box_t return -1; } talloc_set_type(bin, uint8_t); + } else { + bin = talloc_array(ctx, uint8_t, 0); } dst->vb_octets = bin; fr_value_box_copy_meta(dst, src);