summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthieu Herrb <matthieu@cvs.openbsd.org>2008-01-21 21:38:23 +0000
committerMatthieu Herrb <matthieu@cvs.openbsd.org>2008-01-21 21:38:23 +0000
commit7be36bc3f55be74ea63d86c16456ba5618d40bc4 (patch)
treeecb08810da54ef3900033d5998b071b333ac617c
parent7faf80fc6f9c5e6a05f76dd064924ec9931d3ad8 (diff)
3rd try... CVE-2007-6429: Always test for size+offset wrapping. From X.Org.
-rw-r--r--xserver/Xext/shm.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/xserver/Xext/shm.c b/xserver/Xext/shm.c
index 6f99e9064..376f12348 100644
--- a/xserver/Xext/shm.c
+++ b/xserver/Xext/shm.c
@@ -753,10 +753,10 @@ CreatePmap:
if (sizeof(size) == 4 && BitsPerPixel(depth) > 8) {
if (size < width * height)
return BadAlloc;
- /* thankfully, offset is unsigned */
- if (stuff->offset + size < size)
- return BadAlloc;
}
+ /* thankfully, offset is unsigned */
+ if (stuff->offset + size < size)
+ return BadAlloc;
VERIFY_SHMSIZE(shmdesc, stuff->offset, size, client);
@@ -1098,10 +1098,10 @@ CreatePmap:
if (sizeof(size) == 4 && BitsPerPixel(depth) > 8) {
if (size < width * height)
return BadAlloc;
- /* thankfully, offset is unsigned */
- if (stuff->offset + size < size)
- return BadAlloc;
}
+ /* thankfully, offset is unsigned */
+ if (stuff->offset + size < size)
+ return BadAlloc;
VERIFY_SHMSIZE(shmdesc, stuff->offset, size, client);
pMap = (*shmFuncs[pDraw->pScreen->myNum]->CreatePixmap)(