diff options
Diffstat (limited to 'nx-X11/lib/src/StName.c')
-rw-r--r-- | nx-X11/lib/src/StName.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/nx-X11/lib/src/StName.c b/nx-X11/lib/src/StName.c index a003a109e..817ce936d 100644 --- a/nx-X11/lib/src/StName.c +++ b/nx-X11/lib/src/StName.c @@ -27,6 +27,7 @@ in this Software without prior written authorization from The Open Group. #ifdef HAVE_CONFIG_H #include <config.h> #endif +#include <limits.h> #include <nx-X11/Xlibint.h> #include <nx-X11/Xatom.h> @@ -36,9 +37,11 @@ XStoreName ( Window w, _Xconst char *name) { - return XChangeProperty(dpy, w, XA_WM_NAME, XA_STRING, + if (name != NULL && strlen(name) >= USHRT_MAX) + return 0; + return XChangeProperty(dpy, w, XA_WM_NAME, XA_STRING, /* */ 8, PropModeReplace, (_Xconst unsigned char *)name, - name ? strlen(name) : 0); + name ? (int) strlen(name) : 0); } int @@ -47,7 +50,9 @@ XSetIconName ( Window w, _Xconst char *icon_name) { + if (icon_name != NULL && strlen(icon_name) >= USHRT_MAX) + return 0; return XChangeProperty(dpy, w, XA_WM_ICON_NAME, XA_STRING, 8, PropModeReplace, (_Xconst unsigned char *)icon_name, - icon_name ? strlen(icon_name) : 0); + icon_name ? (int) strlen(icon_name) : 0); } |