Skip to content

Commit 03b4f47

Browse files
rustyrussellendothermicdev
authored andcommitted
lightningd: fix log crash on weird escape lines from plugin.
Apparently clboss gives us \u UTF codes. We don't support that (use UTF-8 directly) ``` 126 ../sysdeps/x86_64/multiarch/strlen-vec.S: No such file or directory. (gdb) bt label=label@entry=0x63e2f9604db9 "char *[]") at ccan/ccan/tal/str/str.c:137 complete=complete@entry=0x7ffe9090b0f6, destroyed=destroyed@entry=0x7ffe9090b0f7) at lightningd/plugin.c:773 ``` Reported-by: Ken Sedgwick Fixes: #8338 Changelog-None: broken in this release Signed-off-by: Rusty Russell <[email protected]>
1 parent eddb0e3 commit 03b4f47

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

lightningd/plugin.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -522,13 +522,18 @@ static const char *plugin_log_handle(struct plugin *plugin,
522522
const char *log_msg = json_escape_unescape(tmpctx, esc);
523523
char **lines;
524524

525+
/* Weird \ escapes aren't handled by json_escape_unescape. This is for you, clboss! */
526+
if (!log_msg)
527+
goto print_raw;
528+
525529
lines = tal_strsplit(tmpctx, log_msg, "\n", STR_EMPTY_OK);
526530

527531
for (size_t i = 0; lines[i]; i++) {
528532
/* FIXME: Let plugin specify node_id? */
529533
log_(plugin->log, level, NULL, call_notifier, "%s", lines[i]);
530534
}
531535
} else {
536+
print_raw:
532537
log_(plugin->log, level, NULL, call_notifier, "%.*s",
533538
msgtok->end - msgtok->start,
534539
plugin->buffer + msgtok->start);

0 commit comments

Comments
 (0)