Commit 057cdafd authored by Keith Packard's avatar Keith Packard Committed by Ulrich Sibiller

dix: GetHosts bounds check using wrong pointer value [CVE-2014-8092 pt. 6]

GetHosts saves the pointer to allocated memory in *data, and then wants to bounds-check writes to that region, but was mistakenly using a bare 'data' instead of '*data'. Also, data is declared as void **, so we need a cast to turn it into a byte pointer so we can actually do pointer comparisons. Signed-off-by: 's avatarKeith Packard <keithp@keithp.com> Reviewed-by: 's avatarAlan Coopersmith <alan.coopersmith@oracle.com> Signed-off-by: 's avatarAlan Coopersmith <alan.coopersmith@oracle.com> v1: Keith Packard v2: backport to nx-libs 3.6.x (Ulrich Sibiller)
parent da5da209
......@@ -1699,7 +1699,7 @@ GetHosts (
for (host = validhosts; host; host = host->next)
{
len = host->len;
if ((ptr + sizeof(xHostEntry) + len) > (data + n))
if ((ptr + sizeof(xHostEntry) + len) > ((unsigned char *) *data + n))
break;
((xHostEntry *)ptr)->family = host->family;
((xHostEntry *)ptr)->length = len;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment