summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorBenno Schulenberg <bensberg@telfort.nl>2022-02-14 11:33:25 +0100
committerBenno Schulenberg <bensberg@telfort.nl>2022-02-14 11:47:46 +0100
commit623b77d4f30b47258a40f89262e5aa5d25e95fa7 (patch)
tree6fd4428d185c57205f8299b7a4aa46bcce6332cb /modules
parentb83938f7f97aa6210b00835002e6e7d614b2374a (diff)
imDefLkup: verify that a pointer isn't NULL before using it
It is possible for _XimICOfXICID() to return NULL, so it is necessary to check this isn't actually the case before dereferencing the pointer. All other callers of _XimICOfXICID() do this check too. (The check itself is ugly, but it follows the style of the code in the rest of the module.) Fixes issue #45. Reported-by: Bhavi Dhingra Original-patch-by: Bhavi Dhingra Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
Diffstat (limited to 'modules')
-rw-r--r--modules/im/ximcp/imDefLkup.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/modules/im/ximcp/imDefLkup.c b/modules/im/ximcp/imDefLkup.c
index dea7f66d..dd1adf53 100644
--- a/modules/im/ximcp/imDefLkup.c
+++ b/modules/im/ximcp/imDefLkup.c
@@ -88,7 +88,8 @@ _XimSetEventMaskCallback(
if (imid == im->private.proto.imid) {
if (icid) {
- ic = _XimICOfXICID(im, icid);
+ if (!(ic = _XimICOfXICID(im, icid)))
+ return False;
_XimProcICSetEventMask(ic, (XPointer)&buf_s[2]);
} else {
_XimProcIMSetEventMask(im, (XPointer)&buf_s[2]);