[X2Go-Commits] [nx-libs] 183/429: Keyboard.c: fix possible NULL pointer dereference

git-admin at x2go.org git-admin at x2go.org
Mon Oct 18 09:36:25 CEST 2021


This is an automated email from the git hooks/post-receive script.

x2go pushed a commit to branch 3.6.x
in repository nx-libs.

commit 7443fea69f89fda3c36e99dc5ff07731020e8891
Author: Ulrich Sibiller <uli42 at gmx.de>
Date:   Mon Jan 4 17:18:43 2021 +0100

    Keyboard.c: fix possible NULL pointer dereference
    
    found by PVS Studio: "V522 There might be dereferencing of a potential
    null pointer 'keymap'."
---
 nx-X11/programs/Xserver/hw/nxagent/Keyboard.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c b/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c
index 8f29d66b8..731844874 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c
@@ -435,6 +435,11 @@ N/A
 
         int len = (max_keycode - min_keycode + 1) * mapWidth;
         keymap = (KeySym *)malloc(len * sizeof(KeySym));
+        if (keymap == NULL)
+        {
+          XFreeModifiermap(modifier_keymap);
+          return -1;
+        }
         for(int i = 0; i < len; ++i)
         {
           keymap[i] = keymap64[i];

--
Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/nx-libs.git


More information about the x2go-commits mailing list