ccan: Update vendored ccan to commit 7c38521d, which includes rustyrussell/ccan#128 and rustyrussell/ccan#130#9237
Conversation
|
|
||
| if (json_escape_needed(str, len)) { | ||
| e = json_escape_len(NULL, str, len); | ||
| e = json_escape(NULL, str); |
There was a problem hiding this comment.
There was a problem hiding this comment.
I remember it being related to this previous commit here 400f97d. Rusty used json_out_addstrn instead of json_add_str_fmt(result, fieldname, "%.*s", (int)value_len, value);
for better efficiency but injson_out_addstrnthe escape path wasn't using the length that was passed in. The old path did json_add_str_fmt("%.*s", len, ...) + json_escape_len, so escaping respected the explicit length. json_out_addstrn's escape branch instead called json_escape(NULL, str), which uses strlen.
That broke getlog becuase log messages live in a ring buffer and are not NUL-terminated at loglen, so the json_add_stringn(info->response, "log", log, loglen) call in lightningd/log.c hands json_out_addstrn a non-terminated string. When a log line contains an escapable character, strlen reads past loglen into adjacent ring-buffer memory and emits invalid UTF-8.
There was a problem hiding this comment.
I've created a PR to add this into the ccan repo: rustyrussell/ccan#130
Update update-ccan recipe to use ccan's commit instead of tag since ccan's home moved to github Changelog-None
6afd4aa to
8c71917
Compare
- readme: remove reference to old domain and point to rustyrussell/ccan
8c71917 to
fb93364
Compare
On macOS, failed
connect()calls returnPOLLHUP|POLLERRorPOLLOUT|POLLHUPfrompoll, and the socket error is set toECONNREFUSED. Previously ccan'sio_pollhardcodedEBADFin thePOLLHUPcase, causing misleadingBad file descriptorerrors. The fix readsSO_ERRORfrom the socket to surface the real errno.Also fixes
update-ccanMakefile target:git rev-parse --short HEADinstead ofgit describe(ccan has no tags)ccodearchive.netfollowing rustyrussell/ccan@efd4838Closes #9236.
The test-level fix for
test_networkevents(PR #9140) is still needed but will require a different approach now that the underlying error is correct.Changelog-None