From 192d0b04509e4d77c4e70108062dc9da80489032 Mon Sep 17 00:00:00 2001 From: James Haggerty Date: Sun, 12 Feb 2023 20:27:48 +1100 Subject: Fix cat command If we ran into a heap that wasn't filled with '\0', fun things. --- movement/filesystem.c | 1 + 1 file changed, 1 insertion(+) (limited to 'movement/filesystem.c') diff --git a/movement/filesystem.c b/movement/filesystem.c index 2b345eda..97e35455 100644 --- a/movement/filesystem.c +++ b/movement/filesystem.c @@ -196,6 +196,7 @@ static void filesystem_cat(char *filename) { if (info.size > 0) { char *buf = malloc(info.size + 1); filesystem_read_file(filename, buf, info.size); + buf[info.size] = '\0'; printf("%s\n", buf); free(buf); } else { -- cgit v1.2.3