From: Arran Cudbard-Bell Date: Tue, 28 Jul 2020 19:50:50 +0000 (-0400) Subject: print: Deal with empty octets boxes X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=104f0bf827277e53b9b667760900d8d3288ded5b;p=thirdparty%2Ffreeradius-server.git print: Deal with empty octets boxes --- diff --git a/src/lib/util/print.c b/src/lib/util/print.c index 2bf5c21dc9e..3df64c90adf 100644 --- a/src/lib/util/print.c +++ b/src/lib/util/print.c @@ -740,9 +740,14 @@ char *fr_vasprintf(TALLOC_CTX *ctx, char const *fmt, va_list ap) switch (in->type) { case FR_TYPE_OCTETS: - subst = talloc_array(NULL, char, (in->vb_length * 2) + 1); - if (!subst) goto oom; - fr_bin2hex(&FR_SBUFF_OUT(subst, talloc_array_length(subst)), &FR_DBUFF_TMP(in->vb_octets, in->vb_length)); + if (in->vb_octets) { + subst = talloc_array(NULL, char, (in->vb_length * 2) + 1); + if (!subst) goto oom; + fr_bin2hex(&FR_SBUFF_OUT(subst, talloc_array_length(subst)), &FR_DBUFF_TMP(in->vb_octets, in->vb_length)); + } else { + subst = talloc_zero_array(NULL, char, 1); + if (!subst) goto oom; + } break; case FR_TYPE_STRING: