summaryrefslogtreecommitdiff
path: root/Xext
diff options
context:
space:
mode:
authorMatthieu Herrb <matthieu.herrb@laas.fr>2008-06-10 12:20:00 -0600
committerMatthieu Herrb <matthieu@bluenote.herrb.net>2008-06-11 08:06:09 -0600
commit95d162c4389857d960da9b0158345c1714e91f31 (patch)
treef3f388c171e5e034146a0e4c481c8ca5264f6a0f /Xext
parent656d5d98855eb608ec6581f8c574f343a216ea32 (diff)
CVE-2008-1377 - RECORD and Security extensions memory corruption
Lack of validation of the parameters of the SProcSecurityGenerateAuthorization SProcRecordCreateContext functions makes it possible for a specially crafted request to trigger the swapping of bytes outside the parameter of these requests, causing memory corruption.
Diffstat (limited to 'Xext')
-rw-r--r--Xext/security.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/Xext/security.c b/Xext/security.c
index f28b10dee..bd92600f6 100644
--- a/Xext/security.c
+++ b/Xext/security.c
@@ -676,15 +676,19 @@ SProcSecurityGenerateAuthorization(
char n;
CARD32 *values;
unsigned long nvalues;
+ int values_offset;
swaps(&stuff->length, n);
REQUEST_AT_LEAST_SIZE(xSecurityGenerateAuthorizationReq);
swaps(&stuff->nbytesAuthProto, n);
swaps(&stuff->nbytesAuthData, n);
swapl(&stuff->valueMask, n);
- values = (CARD32 *)(&stuff[1]) +
- ((stuff->nbytesAuthProto + (unsigned)3) >> 2) +
- ((stuff->nbytesAuthData + (unsigned)3) >> 2);
+ values_offset = ((stuff->nbytesAuthProto + (unsigned)3) >> 2) +
+ ((stuff->nbytesAuthData + (unsigned)3) >> 2);
+ if (values_offset >
+ stuff->length - (sz_xSecurityGenerateAuthorizationReq >> 2))
+ return BadLength;
+ values = (CARD32 *)(&stuff[1]) + values_offset;
nvalues = (((CARD32 *)stuff) + stuff->length) - values;
SwapLongs(values, nvalues);
return ProcSecurityGenerateAuthorization(client);