aboutsummaryrefslogtreecommitdiff
path: root/nx-X11/lib/X11
diff options
context:
space:
mode:
authorRoss Burton <ross.burton@intel.com>2015-05-18 14:49:01 +0100
committerUlrich Sibiller <uli42@gmx.de>2016-10-19 21:40:29 +0200
commit1445735ef8fb669de0b96f01939c77ce285b5f4c (patch)
tree84ce001f2458659acd9589f706a02615dbe97408 /nx-X11/lib/X11
parent39dd37d57b7bab3e44304562d1bbf9722bf3e03e (diff)
downloadnx-libs-1445735ef8fb669de0b96f01939c77ce285b5f4c.tar.gz
nx-libs-1445735ef8fb669de0b96f01939c77ce285b5f4c.tar.bz2
nx-libs-1445735ef8fb669de0b96f01939c77ce285b5f4c.zip
Add missing NULL checks to ICWrap
ICWrap.c dereferences the xim parameter passed in from client code without a NULL check. I have seen mplayer trigger this resulting in a segfault. In this case mplayer had called XOpenIM and NULL was returned which was later passed into XCreateIC. Patch originally by Drew Moseley <drew_moseley@mentor.com>. Signed-off-by: Ross Burton <ross.burton@intel.com> Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com> Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Backported-to-NX-by: Ulrich Sibiller <uli42@gmx.de>
Diffstat (limited to 'nx-X11/lib/X11')
-rw-r--r--nx-X11/lib/X11/ICWrap.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/nx-X11/lib/X11/ICWrap.c b/nx-X11/lib/X11/ICWrap.c
index 8c1b4a01c..69f080d87 100644
--- a/nx-X11/lib/X11/ICWrap.c
+++ b/nx-X11/lib/X11/ICWrap.c
@@ -169,7 +169,7 @@ XSetIMValues(XIM im, ...)
va_list var;
int total_count;
XIMArg *args;
- char *ret;
+ char *ret = NULL;
/*
* so count the stuff dangling here
@@ -185,7 +185,8 @@ XSetIMValues(XIM im, ...)
_XIMVaToNestedList(var, total_count, &args);
va_end(var);
- ret = (*im->methods->set_values) (im, args);
+ if (im && im->methods)
+ ret = (*im->methods->set_values) (im, args);
Xfree(args);
return ret;
}
@@ -196,7 +197,7 @@ XGetIMValues(XIM im, ...)
va_list var;
int total_count;
XIMArg *args;
- char *ret;
+ char *ret = NULL;
/*
* so count the stuff dangling here
@@ -212,7 +213,8 @@ XGetIMValues(XIM im, ...)
_XIMVaToNestedList(var, total_count, &args);
va_end(var);
- ret = (*im->methods->get_values) (im, args);
+ if (im && im->methods)
+ ret = (*im->methods->get_values) (im, args);
Xfree(args);
return ret;
}
@@ -228,7 +230,7 @@ XCreateIC(XIM im, ...)
va_list var;
int total_count;
XIMArg *args;
- XIC ic;
+ XIC ic = NULL;
/*
* so count the stuff dangling here
@@ -244,7 +246,8 @@ XCreateIC(XIM im, ...)
_XIMVaToNestedList(var, total_count, &args);
va_end(var);
- ic = (XIC) (*im->methods->create_ic) (im, args);
+ if (im && im->methods)
+ ic = (XIC) (*im->methods->create_ic) (im, args);
Xfree(args);
if (ic) {
ic->core.next = im->core.ic_chain;