From e3e85e007dc589ec28ebbaa3ebfeb702d1846925 Mon Sep 17 00:00:00 2001 From: Jianhui Zhao Date: Sat, 9 Aug 2025 22:32:25 +0800 Subject: [PATCH] The remote cmd response must not exceed 65536 bytes. If it exceeds 65536 bytes, it will cause a communication error. Signed-off-by: Jianhui Zhao --- src/command.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/command.c b/src/command.c index 6aa6e12..ecfb6b2 100644 --- a/src/command.c +++ b/src/command.c @@ -148,6 +148,9 @@ static void cmd_reply(struct task *t, int code) len = ceil(len * 4.0 / 3) + 200; + if (len > 0xffff) + return cmd_err_reply(rtty, t->token, RTTY_CMD_ERR_RESP_TOOBIG); + str = calloc(1, len); if (!str) { cmd_err_reply(t->rtty, t->token, RTTY_CMD_ERR_NOMEM);