From 9a77a995a89cacbfa68e79941307a51f48ca2ec6 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Sat, 11 Feb 2023 12:03:56 +1030 Subject: [PATCH] lightningd: unescape JSON strings for db. We were feeding in the raw JSON, which escapes \". Then we were escaping *again* to return it. Reported-by: @m-schmook Signed-off-by: Rusty Russell Changelog-Fixed: JSON-RPC: `datastore` handles escapes in `string` parameter correctly. --- lightningd/datastore.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lightningd/datastore.c b/lightningd/datastore.c index 6967505da..4fced8222 100644 --- a/lightningd/datastore.c +++ b/lightningd/datastore.c @@ -136,7 +136,7 @@ static struct command_result *json_datastore(struct command *cmd, if (!param(cmd, buffer, params, p_req("key", param_list_or_string, &key), - p_opt("string", param_string, &strdata), + p_opt("string", param_escaped_string, &strdata), p_opt("hex", param_bin_from_hex, &data), p_opt_def("mode", param_mode, &mode, DS_MUST_NOT_EXIST), p_opt("generation", param_u64, &generation),