Skip to content
Permalink
Browse files

evdev: Fix 'Syscall param ioctl(TIOCLINUX) points to uninitialised byte'

  • Loading branch information
BrandonSchaefer committed Jul 28, 2017
1 parent 77ca0f2 commit be005b7c7874b8e710669ddd0e2ec9b1b7aad544
Showing with 4 additions and 4 deletions.
  1. +4 −4 src/core/linux/SDL_evdev_kbd.c
@@ -196,7 +196,8 @@ SDL_EVDEV_kbd_init(void)
{
SDL_EVDEV_keyboard_state *kbd;
int i;
char shift_state, flag_state;
char flag_state;
char shift_state[2] = {TIOCL_GETSHIFTSTATE, 0};

kbd = (SDL_EVDEV_keyboard_state *)SDL_calloc(1, sizeof(*kbd));
if (!kbd) {
@@ -208,9 +209,8 @@ SDL_EVDEV_kbd_init(void)
/* This might fail if we're not connected to a tty (e.g. on the Steam Link) */
kbd->console_fd = open("/dev/tty", O_RDONLY);

shift_state = TIOCL_GETSHIFTSTATE;
if (ioctl(kbd->console_fd, TIOCLINUX, &shift_state) == 0) {
kbd->shift_state = shift_state;
if (ioctl(kbd->console_fd, TIOCLINUX, shift_state) == 0) {
kbd->shift_state = *shift_state;
}

if (ioctl(kbd->console_fd, KDGKBLED, &flag_state) == 0) {

0 comments on commit be005b7

Please sign in to comment.