From 29c7ca80c9df8f805217be9bb9a9a083ff12912d Mon Sep 17 00:00:00 2001 From: cinap_lenrek Date: Mon, 16 May 2016 21:10:08 +0200 Subject: [PATCH] correct check for segment overlap (rmiller) --- sys/src/9/port/segment.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/sys/src/9/port/segment.c b/sys/src/9/port/segment.c index e7f2f42b0..f675ac1c5 100644 --- a/sys/src/9/port/segment.c +++ b/sys/src/9/port/segment.c @@ -427,7 +427,7 @@ ibrk(uintptr addr, int seg) ns = up->seg[i]; if(ns == nil || ns == s) continue; - if(newtop >= ns->base && newtop < ns->top) { + if(newtop > ns->base && s->base < ns->top) { qunlock(s); error(Esoverlap); } @@ -544,8 +544,7 @@ isoverlap(uintptr va, uintptr len) ns = up->seg[i]; if(ns == nil) continue; - if((newtop > ns->base && newtop <= ns->top) || - (va >= ns->base && va < ns->top)) + if(newtop > ns->base && va < ns->top) return ns; } return nil;