aboutsummaryrefslogtreecommitdiff
path: root/nx-X11/programs/Xserver/os/access.c
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2014-01-06 23:30:14 -0800
committerMike Gabriel <mike.gabriel@das-netzwerkteam.de>2015-02-14 16:14:31 +0100
commitd4c76981f7fddb364166464c571ed8d3de3086cd (patch)
tree4e3d6c0465164e02a944e791c09a34dc34c6c58c /nx-X11/programs/Xserver/os/access.c
parentc1225fe6451d7a5f3741ce0fff8f54e38e0a14da (diff)
downloadnx-libs-d4c76981f7fddb364166464c571ed8d3de3086cd.tar.gz
nx-libs-d4c76981f7fddb364166464c571ed8d3de3086cd.tar.bz2
nx-libs-d4c76981f7fddb364166464c571ed8d3de3086cd.zip
dix: integer overflow in GetHosts() [CVE-2014-8092 2/4]
GetHosts() iterates over all the hosts it has in memory, and copies them to a buffer. The buffer length is calculated by iterating over all the hosts and adding up all of their combined length. There is a potential integer overflow, if there are lots and lots of hosts (with a combined length of > ~4 gig). This should be possible by repeatedly calling ProcChangeHosts() on 64bit machines with enough memory. This patch caps the list at 1mb, because multi-megabyte hostname lists for X access control are insane. v2: backport to nx-libs 3.6.x (Mike DePaulo) Reported-by: Ilja Van Sprundel <ivansprundel@ioactive.com> Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Conflicts: os/access.c
Diffstat (limited to 'nx-X11/programs/Xserver/os/access.c')
-rw-r--r--nx-X11/programs/Xserver/os/access.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/nx-X11/programs/Xserver/os/access.c b/nx-X11/programs/Xserver/os/access.c
index b6a70a703..0e9d13845 100644
--- a/nx-X11/programs/Xserver/os/access.c
+++ b/nx-X11/programs/Xserver/os/access.c
@@ -1719,6 +1719,10 @@ GetHosts (
{
nHosts++;
n += (((host->len + 3) >> 2) << 2) + sizeof(xHostEntry);
+ /* Could check for INT_MAX, but in reality having more than 1mb of
+ hostnames in the access list is ridiculous */
+ if (n >= 1048576)
+ break;
}
if (n)
{
@@ -1730,6 +1734,8 @@ GetHosts (
for (host = validhosts; host; host = host->next)
{
len = host->len;
+ if ((ptr + sizeof(xHostEntry) + len) > (data + n))
+ break;
((xHostEntry *)ptr)->family = host->family;
((xHostEntry *)ptr)->length = len;
ptr += sizeof(xHostEntry);