From b4975ee0d4b3bd551d0850b539d7b84f37b92881 Mon Sep 17 00:00:00 2001 From: aizu-m Date: Tue, 9 Jun 2026 12:15:12 +0530 Subject: [PATCH] fix off-by-one in ProtocolGet and ProtocolOpenDir recv buffers --- libcfnet/protocol.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libcfnet/protocol.c b/libcfnet/protocol.c index b0f16e6acf..0719af9554 100644 --- a/libcfnet/protocol.c +++ b/libcfnet/protocol.c @@ -38,7 +38,7 @@ Seq *ProtocolOpenDir(AgentConnection *conn, const char *path) assert(conn != NULL); assert(path != NULL); - char buf[CF_MSGSIZE] = {0}; + char buf[CF_BUFSIZE] = {0}; int tosend = snprintf(buf, CF_MSGSIZE, "OPENDIR %s", path); if (tosend < 0 || tosend >= CF_MSGSIZE) { @@ -110,7 +110,7 @@ bool ProtocolGet(AgentConnection *conn, const char *remote_path, return false; } - char buf[CF_MSGSIZE] = {0}; + char buf[CF_BUFSIZE] = {0}; int to_send = snprintf(buf, CF_MSGSIZE, "GET %d %s", CF_MSGSIZE, remote_path);