From 534ac6bf64f60e18f34ac28903e83a455f32163c Mon Sep 17 00:00:00 2001 From: David Anderson Date: Thu, 5 Sep 2024 14:40:58 -0700 Subject: [PATCH] fix possible buffer overflow --- client/sandbox.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/client/sandbox.cpp b/client/sandbox.cpp index 86255be6c8..f27f46f464 100644 --- a/client/sandbox.cpp +++ b/client/sandbox.cpp @@ -107,7 +107,7 @@ int switcher_exec(const char *util_filename, const char* cmdline) { // Capture stdout output while (1) { - ssize_t count = read(fds_out[0], buffer, sizeof(buffer)); + ssize_t count = read(fds_out[0], buffer, sizeof(buffer)-1); if (count == -1) { if (errno == EINTR) { continue; @@ -124,7 +124,7 @@ int switcher_exec(const char *util_filename, const char* cmdline) { // Capture stderr output while (1) { - ssize_t count = read(fds_err[0], buffer, sizeof(buffer)); + ssize_t count = read(fds_err[0], buffer, sizeof(buffer)-1); if (count == -1) { if (errno == EINTR) { continue;