From: Alan T. DeKok Date: Fri, 18 Dec 2020 21:59:55 +0000 (-0500) Subject: if there's no input, we don't need to convert it to hex X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=f480763ab4d0bcb0d685d6e156369cc355c28165;p=thirdparty%2Ffreeradius-server.git if there's no input, we don't need to convert it to hex --- diff --git a/src/lib/unlang/xlat_builtin.c b/src/lib/unlang/xlat_builtin.c index 91cef2f20f7..b79cde3c5f1 100644 --- a/src/lib/unlang/xlat_builtin.c +++ b/src/lib/unlang/xlat_builtin.c @@ -1874,7 +1874,9 @@ static xlat_action_t xlat_func_hex(TALLOC_CTX *ctx, fr_cursor_t *out, MEM(vb = fr_value_box_alloc(ctx, FR_TYPE_STRING, NULL, false)); vb->vb_length = ((*in)->vb_length * 2); vb->vb_strvalue = p = talloc_zero_array(vb, char, vb->vb_length + 1); - fr_bin2hex(&FR_SBUFF_OUT(p, talloc_array_length(p)), &FR_DBUFF_TMP((*in)->vb_octets, (*in)->vb_length), SIZE_MAX); + if ((*in)->vb_length) { + fr_bin2hex(&FR_SBUFF_OUT(p, talloc_array_length(p)), &FR_DBUFF_TMP((*in)->vb_octets, (*in)->vb_length), SIZE_MAX); + } fr_cursor_append(out, vb);