Skip to content

Commit 3dd0979

Browse files
whitslackrustyrussell
authored andcommitted
lightningd: use json_escape_unescape_len for log message strings received from plugins
[ Reduced to just neatening, as 23997b2 did the unescape handling already -- RR ]
1 parent c28f5e7 commit 3dd0979

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

lightningd/plugin.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -516,10 +516,9 @@ static const char *plugin_log_handle(struct plugin *plugin,
516516

517517
/* Only bother unescaping and splitting if it has \ */
518518
if (memchr(plugin->buffer + msgtok->start, '\\', msgtok->end - msgtok->start)) {
519-
const char *log_escaped = plugin->buffer + msgtok->start;
520-
const size_t log_escaped_len = msgtok->end - msgtok->start;
521-
struct json_escape *esc = json_escape_string_(tmpctx, log_escaped, log_escaped_len);
522-
const char *log_msg = json_escape_unescape(tmpctx, esc);
519+
const char *log_msg = json_escape_unescape_len(tmpctx,
520+
plugin->buffer + msgtok->start,
521+
msgtok->end - msgtok->start);
523522
char **lines;
524523

525524
/* Weird \ escapes aren't handled by json_escape_unescape. This is for you, clboss! */

0 commit comments

Comments
 (0)