kernel: make sure we wont run into the tos when copying exec() arguments
in case the calling process changes its arguments under us, it could happen that the final argument string lengths become bigger than initially calculated. this is fine as we still make sure we wont overflow the stack segment, but we could overrun into the tos structure at the end of the stack. so change the limit to the base of the tos, not the end of the stack segment.
This commit is contained in:
parent
ff3e0eeb22
commit
adb36de077
1 changed files with 3 additions and 1 deletions
|
@ -466,8 +466,10 @@ sysexec(va_list list)
|
|||
if(indir)
|
||||
e = strchr(a, 0);
|
||||
else {
|
||||
if(charp >= (char*)tos)
|
||||
error(Ebadarg);
|
||||
validaddr((uintptr)a, 1, 0);
|
||||
e = vmemchr(a, 0, (char*)tstk - charp);
|
||||
e = vmemchr(a, 0, (char*)tos - charp);
|
||||
if(e == nil)
|
||||
error(Ebadarg);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue