From 124f5a5c6e4f37880c482d1037636ccfd7b6fca0 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Tue, 2 Mar 2021 23:12:03 +0100 Subject: Clipboard.c: sanity check for invalid resource --- nx-X11/programs/Xserver/hw/nxagent/Clipboard.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'nx-X11/programs') diff --git a/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c b/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c index 8844c88df..7fefd5ee1 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c @@ -1592,6 +1592,14 @@ Bool nxagentCollectPropertyEventFromXServer(int resource) int index = 0; + if (resource < 0) + { + #ifdef DEBUG + fprintf (stderr, "%s: resource [%d] is invalid.\n", __func__, resource); + #endif + return False; + } + /* determine the selection we are talking about here */ for (index = 0; index < nxagentMaxSelections; index++) { -- cgit v1.2.3