fix possible buffer overflow

This commit is contained in:
David Anderson 2024-09-05 14:40:58 -07:00
parent 4463029fa9
commit 534ac6bf64
1 changed files with 2 additions and 2 deletions

View File

@ -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;