From d41fcd8817f28dc108836b5f9bec031a4c976b94 Mon Sep 17 00:00:00 2001 From: Ry Date: Thu, 14 Sep 2023 14:58:10 -0700 Subject: [PATCH] kernel/vfs: Sanity checks before performing reads/writes --- kernel/vfs/vfs.asm | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/kernel/vfs/vfs.asm b/kernel/vfs/vfs.asm index dfb65fc..6bcd987 100644 --- a/kernel/vfs/vfs.asm +++ b/kernel/vfs/vfs.asm @@ -151,6 +151,12 @@ stream_get_size: ; outputs: ; none read: + cmp r0, 0 + ifz ret + cmp r1, 0 + ifz ret + cmp r2, 0 + ifz ret push r3 push r1 add r1, 7 @@ -212,6 +218,10 @@ stream_read_char: ; outputs: ; none write: + cmp r0, 0 + ifz ret + cmp r1, 0 + ifz ret push r3 push r1 add r1, 7