Fix cat command
If we ran into a heap that wasn't filled with '\0', fun things.
This commit is contained in:
parent
59ff549235
commit
192d0b0450
@ -196,6 +196,7 @@ static void filesystem_cat(char *filename) {
|
|||||||
if (info.size > 0) {
|
if (info.size > 0) {
|
||||||
char *buf = malloc(info.size + 1);
|
char *buf = malloc(info.size + 1);
|
||||||
filesystem_read_file(filename, buf, info.size);
|
filesystem_read_file(filename, buf, info.size);
|
||||||
|
buf[info.size] = '\0';
|
||||||
printf("%s\n", buf);
|
printf("%s\n", buf);
|
||||||
free(buf);
|
free(buf);
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user