From ae7af6e6cf2f9959ecc1a5cd2a6079d801465b2d Mon Sep 17 00:00:00 2001 From: Freywar Ulvnaudgari Date: Tue, 25 Aug 2026 23:07:54 +0300 Subject: [PATCH] Fix `cat` and `wc` Trying to fit 64K onto stack was a bad idea. --- src/user/app/cat/cat.c | 2 +- src/user/app/wc/wc.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/user/app/cat/cat.c b/src/user/app/cat/cat.c index 70a2465..b7820be 100644 --- a/src/user/app/cat/cat.c +++ b/src/user/app/cat/cat.c @@ -5,7 +5,7 @@ #define BLOCK_SIZE 65536 exit_code_t pass(uint64_t fd) { - char buffer[BLOCK_SIZE]; + static char buffer[BLOCK_SIZE]; uint64_t bytes; while ((bytes = read(fd, BLOCK_SIZE, buffer))) { if (bytes == (uint64_t)-1) { diff --git a/src/user/app/wc/wc.c b/src/user/app/wc/wc.c index afb002e..36f20af 100644 --- a/src/user/app/wc/wc.c +++ b/src/user/app/wc/wc.c @@ -6,7 +6,7 @@ #define BLOCK_SIZE 65536 exit_code_t pass(uint64_t fd) { - char buffer[BLOCK_SIZE]; + static char buffer[BLOCK_SIZE]; uint64_t bytes; uint64_t total = 0; while ((bytes = read(fd, BLOCK_SIZE, buffer))) {