Commit 052b4f2969aa9d9d9adf63cf0d1ec40472eb5038

Sylvain Becker 2019-03-12T14:20:37

SDL_EVDEV_kbd_init: uninitialized data for ioctl (Bug 4530) Only two chars are used but the full prototype is: int tioclinux(struct tty_struct *tty, unsigned long arg) ==5010== Syscall param ioctl(TIOCLINUX) points to uninitialised byte(s) ==5010== at 0x53E73C7: ioctl (syscall-template.S:78) ==5010== by 0x4A887DA: SDL_EVDEV_Init (SDL_evdev.c:163) ==5010== by 0x4A7D157: KMSDRM_VideoInit (SDL_kmsdrmvideo.c:509) ==5010== by 0x497D959: SDL_VideoInit_REAL (SDL_video.c:529) ==5010== by 0x487ACBC: SDL_InitSubSystem_REAL (SDL.c:171) ==5010== by 0x487B052: SDL_Init_REAL (SDL.c:256) ==5010== by 0x488F7D6: SDL_Init (SDL_dynapi_procs.h:85)

1
2
3
4
5
6
7
8
9
10
11
12
13
diff --git a/src/core/linux/SDL_evdev_kbd.c b/src/core/linux/SDL_evdev_kbd.c
index 6e2e8d5..208ab68 100644
--- a/src/core/linux/SDL_evdev_kbd.c
+++ b/src/core/linux/SDL_evdev_kbd.c
@@ -345,7 +345,7 @@ SDL_EVDEV_kbd_init(void)
     SDL_EVDEV_keyboard_state *kbd;
     int i;
     char flag_state;
-    char shift_state[2] = {TIOCL_GETSHIFTSTATE, 0};
+    char shift_state[ sizeof (long) ] = {TIOCL_GETSHIFTSTATE, 0};
 
     kbd = (SDL_EVDEV_keyboard_state *)SDL_calloc(1, sizeof(*kbd));
     if (!kbd) {