aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/glx/clientinfo.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2012-06-15 08:55:18 +0200
committermarha <marha@users.sourceforge.net>2012-06-15 08:55:18 +0200
commitd6f64084b9bc07d0bdd527f9354f2d1d962ed16d (patch)
tree81b2652d421992fd63143a04885e332e83e18d07 /xorg-server/glx/clientinfo.c
parent669b562a737c9418c53bfae69c0dbf1aabe318b4 (diff)
parent7a2af605c2c2b0d2e9bbb0b161eba8842acefbcb (diff)
downloadvcxsrv-d6f64084b9bc07d0bdd527f9354f2d1d962ed16d.tar.gz
vcxsrv-d6f64084b9bc07d0bdd527f9354f2d1d962ed16d.tar.bz2
vcxsrv-d6f64084b9bc07d0bdd527f9354f2d1d962ed16d.zip
Merge remote-tracking branch 'origin/released'
Conflicts: fontconfig/src/fcint.h fontconfig/src/fcstat.c mesalib/src/mapi/glapi/gen/GL3x.xml xorg-server/glx/glxext.h
Diffstat (limited to 'xorg-server/glx/clientinfo.c')
-rw-r--r--xorg-server/glx/clientinfo.c49
1 files changed, 47 insertions, 2 deletions
diff --git a/xorg-server/glx/clientinfo.c b/xorg-server/glx/clientinfo.c
index 15bbf15af..b26ac1a72 100644
--- a/xorg-server/glx/clientinfo.c
+++ b/xorg-server/glx/clientinfo.c
@@ -26,17 +26,62 @@
#include "glxserver.h"
#include "indirect_dispatch.h"
+#include "glxbyteorder.h"
+#include "unpack.h"
int
__glXDisp_SetClientInfoARB(__GLXclientState * cl, GLbyte * pc)
{
- return BadRequest;
+ xGLXSetClientInfoARBReq *req = (xGLXSetClientInfoARBReq *) pc;
+ char *gl_extensions;
+ char *glx_extensions;
+
+ /* Verify that the size of the packet matches the size inferred from the
+ * sizes specified for the various fields.
+ */
+ const unsigned expected_size = sz_xGLXSetClientInfoARBReq
+ + (req->numVersions * 8)
+ + __GLX_PAD(req->numGLExtensionBytes)
+ + __GLX_PAD(req->numGLXExtensionBytes);
+
+ if (req->length != (expected_size / 4))
+ return BadLength;
+
+ /* Verify that the actual length of the GL extension string matches what's
+ * encoded in protocol packet.
+ */
+ gl_extensions = (char *) (req + 1) + (req->numVersions * 8);
+ if (req->numGLExtensionBytes != 0
+ && memchr(gl_extensions, 0,
+ __GLX_PAD(req->numGLExtensionBytes)) == NULL)
+ return BadLength;
+
+ /* Verify that the actual length of the GLX extension string matches
+ * what's encoded in protocol packet.
+ */
+ glx_extensions = gl_extensions + __GLX_PAD(req->numGLExtensionBytes);
+ if (req->numGLXExtensionBytes != 0
+ && memchr(glx_extensions, 0,
+ __GLX_PAD(req->numGLXExtensionBytes)) == NULL)
+ return BadLength;
+
+ free(cl->GLClientextensions);
+ cl->GLClientextensions = strdup(gl_extensions);
+
+ return 0;
}
int
__glXDispSwap_SetClientInfoARB(__GLXclientState * cl, GLbyte * pc)
{
- return BadRequest;
+ xGLXSetClientInfoARBReq *req = (xGLXSetClientInfoARBReq *) pc;
+
+ req->length = bswap_16(req->length);
+ req->numVersions = bswap_32(req->numVersions);
+ req->numGLExtensionBytes = bswap_32(req->numGLExtensionBytes);
+ req->numGLXExtensionBytes = bswap_32(req->numGLXExtensionBytes);
+
+ return __glXDisp_SetClientInfoARB(cl, pc);
}
int