aboutsummaryrefslogtreecommitdiff
path: root/nx-X11/lib/src/QuExt.c
diff options
context:
space:
mode:
Diffstat (limited to 'nx-X11/lib/src/QuExt.c')
-rw-r--r--nx-X11/lib/src/QuExt.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/nx-X11/lib/src/QuExt.c b/nx-X11/lib/src/QuExt.c
index 4e230e776..68c174662 100644
--- a/nx-X11/lib/src/QuExt.c
+++ b/nx-X11/lib/src/QuExt.c
@@ -27,6 +27,8 @@ in this Software without prior written authorization from The Open Group.
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
+#include <limits.h>
+#include <stdbool.h>
#include "Xlibint.h"
Bool
@@ -40,9 +42,12 @@ XQueryExtension(
xQueryExtensionReply rep;
register xQueryExtensionReq *req;
+ if (name != NULL && strlen(name) >= USHRT_MAX)
+ return false;
+
LockDisplay(dpy);
GetReq(QueryExtension, req);
- req->nbytes = name ? strlen(name) : 0;
+ req->nbytes = name ? (CARD16) strlen(name) : 0;
req->length += (req->nbytes+(unsigned)3)>>2;
_XSend(dpy, name, (long)req->nbytes);
(void) _XReply (dpy, (xReply *)&rep, 0, xTrue);