diff options
author | Matthieu Herrb <matthieu@cvs.openbsd.org> | 2014-12-09 17:58:54 +0000 |
---|---|---|
committer | Matthieu Herrb <matthieu@cvs.openbsd.org> | 2014-12-09 17:58:54 +0000 |
commit | a585be1a395b9a0636f34b828859cd8031741633 (patch) | |
tree | b6a2594689d1bd1cb681cc19917563b4316e6d0a /xserver/os | |
parent | 41d594947842df4658fc39cfc15d2c3514548cbe (diff) |
Protocol handling issues in X Window System servers
One year after Ilja van Sprundel, discovered and reported a large number
of issues in the way the X server code base handles requests from X clients,
they have been fixed.
Diffstat (limited to 'xserver/os')
-rw-r--r-- | xserver/os/access.c | 6 | ||||
-rw-r--r-- | xserver/os/rpcauth.c | 4 |
2 files changed, 10 insertions, 0 deletions
diff --git a/xserver/os/access.c b/xserver/os/access.c index e8c0781f2..e5a067220 100644 --- a/xserver/os/access.c +++ b/xserver/os/access.c @@ -1323,6 +1323,10 @@ GetHosts(void **data, int *pnHosts, int *pLen, BOOL * pEnabled) for (host = validhosts; host; host = host->next) { nHosts++; n += pad_to_int32(host->len) + 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) { *data = ptr = malloc(n); @@ -1331,6 +1335,8 @@ GetHosts(void **data, int *pnHosts, int *pLen, BOOL * pEnabled) } 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); diff --git a/xserver/os/rpcauth.c b/xserver/os/rpcauth.c index d60ea3518..413cc6118 100644 --- a/xserver/os/rpcauth.c +++ b/xserver/os/rpcauth.c @@ -66,6 +66,10 @@ authdes_ezdecode(const char *inmsg, int len) SVCXPRT xprt; temp_inmsg = malloc(len); + if (temp_inmsg == NULL) { + why = AUTH_FAILED; /* generic error, since there is no AUTH_BADALLOC */ + return NULL; + } memmove(temp_inmsg, inmsg, len); memset((char *) &msg, 0, sizeof(msg)); |