fix memory region validation in argptr()

This commit is contained in:
MikeCAT 2015-12-19 22:52:11 +09:00 committed by Frans Kaashoek
parent 0df5f11bae
commit 2a675089b1

View file

@ -58,7 +58,7 @@ argptr(int n, char **pp, int size)
if(argint(n, &i) < 0) if(argint(n, &i) < 0)
return -1; 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; return -1;
*pp = (char*)i; *pp = (char*)i;
return 0; return 0;