From 180da90a06f534dc2f1ae1a6faf2da5168608b97 Mon Sep 17 00:00:00 2001 From: Giacomo Tesio Date: Mon, 14 Aug 2017 19:25:49 +0200 Subject: [PATCH] kernel: fix args crossing page boundaries in sysexec Should also fix CID 155615 (Operands don't affect result) --- sys/src/kern/port/sysproc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/src/kern/port/sysproc.c b/sys/src/kern/port/sysproc.c index 92a68a3..1caa91e 100644 --- a/sys/src/kern/port/sysproc.c +++ b/sys/src/kern/port/sysproc.c @@ -400,7 +400,7 @@ sysexec(char* p, char **argv) argsize += sizeof(uintptr_t); /* place for argc = nil */ tmp = up->seg[ESEG]->top - argsize; - if(tmp&~(PGSZ-1) != (tmp+sizeof(uintptr_t)+sizeof(char*)*(argc+1))&~(PGSZ-1)){ + if((tmp&~(PGSZ-1)) != ((tmp+sizeof(uintptr_t)+sizeof(char*)*(argc+1))&~(PGSZ-1))){ /* the argument pointers cross a page boundary, keep * them all in the same page */