]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
if there's no input, we don't need to convert it to hex
authorAlan T. DeKok <aland@freeradius.org>
Fri, 18 Dec 2020 21:59:55 +0000 (16:59 -0500)
committerAlan T. DeKok <aland@freeradius.org>
Fri, 18 Dec 2020 22:02:17 +0000 (17:02 -0500)
src/lib/unlang/xlat_builtin.c

index 91cef2f20f70e66e2999f8d620f71676d8cef062..b79cde3c5f1e095e12167de3611ca59965407a14 100644 (file)
@@ -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);