From c80a1f39ce4e658542c9f17eb071736c381005cb Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Tue, 23 Oct 2018 13:57:17 +0200 Subject: [PATCH] Minor userland tweaks. --- Userland/ps.cpp | 2 +- Userland/sh.cpp | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/Userland/ps.cpp b/Userland/ps.cpp index 5b620d96e4..a1cc620c20 100644 --- a/Userland/ps.cpp +++ b/Userland/ps.cpp @@ -9,7 +9,7 @@ int main(int c, char** v) return 1; } for (;;) { - char buf[16]; + char buf[128]; ssize_t nread = read(fd, buf, sizeof(buf)); if (nread == 0) break; diff --git a/Userland/sh.cpp b/Userland/sh.cpp index 358423c245..6ec7a5e42a 100644 --- a/Userland/sh.cpp +++ b/Userland/sh.cpp @@ -41,6 +41,12 @@ int main(int c, char** v) printf("failed to read :(\n"); return 2; } + if (nread > 2) + printf("read %u bytes\n", nread); + if (nread > (ssize_t)sizeof(keybuf)) { + printf("read() overran the buffer i gave it!\n"); + return 3; + } for (ssize_t i = 0; i < nread; ++i) { putchar(keybuf[i]); if (keybuf[i] != '\n') {