]> Devi Nivas Git - cs3210-lab0.git/commitdiff
fix memory region validation in argptr()
authorMikeCAT <mikecat@users.noreply.github.com>
Sat, 19 Dec 2015 13:52:11 +0000 (22:52 +0900)
committerFrans Kaashoek <kaashoek@mit.edu>
Mon, 26 Sep 2016 11:52:17 +0000 (07:52 -0400)
syscall.c

index a84a9219a51e75d10a04014331cebbd990a4ca82..9ae75367cd495a71737764ded186ec94c2bfcbda 100644 (file)
--- a/syscall.c
+++ b/syscall.c
@@ -58,7 +58,7 @@ argptr(int n, char **pp, int size)
 
   if(argint(n, &i) < 0)
     return -1;
-  if((uint)i >= proc->sz || (uint)i+size > proc->sz)
+  if(size < 0 || (uint)i >= proc->sz || (uint)i+size > proc->sz)
     return -1;
   *pp = (char*)i;
   return 0;