JSONRPC: use a bigger default buffer.
What changed, and why it matters
This commit simply increases the default memory buffer size used when reading JSON-RPC messages. The change is described by the author as a performance tweak to reduce the number of small reads, not a security fix. There is no indication in the commit or supplied references that this resolves a vulnerability.
No security action required. Treat as a routine performance optimization.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The patch changes READ_CHUNKSIZE from 64 bytes to 2048 bytes and doubles the initial membuf allocation in common/jsonrpc_io.c. The commit message frames this as a performance optimization for JSON-RPC I/O, explicitly noting a trade-off between fewer reads and fairness. No security relevance, bug fix, or vulnerability is mentioned.
Changed components
common/jsonrpc_io.cInspect captured patch +4 / −3
diff --git a/common/jsonrpc_io.c b/common/jsonrpc_io.c
index 48c46c42..ab7255a9 100644
--- a/common/jsonrpc_io.c
+++ b/common/jsonrpc_io.c
@@ -8,7 +8,7 @@
#include <errno.h>
#include <unistd.h>
-#define READ_CHUNKSIZE 64
+#define READ_CHUNKSIZE 2048
struct jsonrpc_io {
MEMBUF(char) membuf;
@@ -22,13 +22,14 @@ struct jsonrpc_io {
struct jsonrpc_io *jsonrpc_io_new(const tal_t *ctx)
{
struct jsonrpc_io *json_in;
+ const size_t bufsize = READ_CHUNKSIZE * 2;
json_in = tal(ctx, struct jsonrpc_io);
json_in->bytes_read = 0;
membuf_init(&json_in->membuf,
- tal_arr(json_in, char, READ_CHUNKSIZE),
- READ_CHUNKSIZE, membuf_tal_resize);
+ tal_arr(json_in, char, bufsize),
+ bufsize, membuf_tal_resize);
json_in->toks = toks_alloc(json_in);
jsmn_init(&json_in->parser);
Why this scored 18/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.