From 2aba269abf18bcb83d97ed4160fa285efe84a0e2 Mon Sep 17 00:00:00 2001 From: Arran Cudbard-Bell Date: Mon, 6 Dec 2021 21:51:11 -0500 Subject: [PATCH] Fix json taint test --- src/lib/json/jpath.c | 2 +- src/lib/unlang/xlat_eval.c | 1 + src/tests/modules/json/eval.unlang | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/lib/json/jpath.c b/src/lib/json/jpath.c index a312aa940df..1c776dd6210 100644 --- a/src/lib/json/jpath.c +++ b/src/lib/json/jpath.c @@ -122,7 +122,7 @@ size_t fr_jpath_escape_func(UNUSED request_t *request, char *out, size_t outlen, } *q = '\0'; - return q - end; + return q - out; } /** Recursive function for jpath_expr_evaluate diff --git a/src/lib/unlang/xlat_eval.c b/src/lib/unlang/xlat_eval.c index 3fbb5f71236..55e512f033d 100644 --- a/src/lib/unlang/xlat_eval.c +++ b/src/lib/unlang/xlat_eval.c @@ -1425,6 +1425,7 @@ static ssize_t xlat_eval_sync(TALLOC_CTX *ctx, char **out, request_t *request, x entry = vb->entry; fr_value_box_clear_value(vb); fr_value_box_bstrndup(vb, vb, NULL, escaped, real_len, false); + FR_FAULT_LOG("ESCAPED %zu %s", real_len, escaped); vb->entry = entry; talloc_free(escaped); diff --git a/src/tests/modules/json/eval.unlang b/src/tests/modules/json/eval.unlang index 53e5954a778..fc9f62d7010 100644 --- a/src/tests/modules/json/eval.unlang +++ b/src/tests/modules/json/eval.unlang @@ -434,7 +434,7 @@ update request { {\ \"foo.bar\": \"baz\" \ }" - &Tmp-String-2 := 'foo.bar' + &Tmp-String-2 := %{taint:foo.bar} } map json &Tmp-String-0 { &Tmp-String-1 := "$.%{Tmp-String-2}" -- 2.47.3