]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Don't need to do work if pad_len is the same length as the thing being padded
authorArran Cudbard-Bell <a.cudbardb@freeradius.org>
Thu, 3 Feb 2022 16:05:44 +0000 (11:05 -0500)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Thu, 3 Feb 2022 16:06:24 +0000 (11:06 -0500)
src/lib/unlang/xlat_builtin.c

index c54f5fdb4d22a8015e50bebf8d8edcff14e182e7..261e32a933eede2ab532d73c3bc47a5c5cbb319c 100644 (file)
@@ -1684,7 +1684,7 @@ static xlat_action_t xlat_func_lpad(UNUSED TALLOC_CTX *ctx, fr_dcursor_t *out,
 
                fr_dcursor_append(out, in);
 
-               if (len > pad_len) continue;
+               if (len >= pad_len) continue;
 
                if (fr_value_box_bstr_realloc(in, &buff, in, pad_len) < 0) {
                        RPEDEBUG("Failed reallocing input data");
@@ -1764,7 +1764,7 @@ static xlat_action_t xlat_func_rpad(UNUSED TALLOC_CTX *ctx, fr_dcursor_t *out,
 
                fr_dcursor_append(out, in);
 
-               if (len > pad_len) continue;
+               if (len >= pad_len) continue;
 
                if (fr_value_box_bstr_realloc(in, &buff, in, pad_len) < 0) {
                        RPEDEBUG("Failed reallocing input data");