Commit d948e6c3c592db7bfdcf14d4e869ff8db238e50a

Sylvain 2023-02-15T22:38:57

Fix potential de-referencing null pointer in SDL_EVDEV_kbd_keycode()

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
diff --git a/src/core/freebsd/SDL_evdev_kbd_freebsd.c b/src/core/freebsd/SDL_evdev_kbd_freebsd.c
index be00b1e..a5cedbf 100644
--- a/src/core/freebsd/SDL_evdev_kbd_freebsd.c
+++ b/src/core/freebsd/SDL_evdev_kbd_freebsd.c
@@ -476,12 +476,12 @@ void SDL_EVDEV_kbd_keycode(SDL_EVDEV_keyboard_state *kbd, unsigned int keycode, 
     unsigned int final_key_state;
     unsigned int map_from_key_sym;
 
-    key_map = *kbd->key_map;
-
     if (kbd == NULL) {
         return;
     }
 
+    key_map = *kbd->key_map;
+
     kbd->rep = (down == 2);
 
     if (keycode < NUM_KEYS) {