sdl2_frt/src/core/linux
Sam Lantinga 41be9756f0 Fixed bug 3546 - SDL_EVDEV_is_console() uses type of wrong size when calling ioctl
Rob

When calling ioctl(fd, KDGKBTYPE, &type) in SDL_EVDEV_is_console(), we declare type as an 'int'.  This should be a 'char'.  The subsequent syscall, and kernel code, only writes the lower byte of the word.

See: http://lxr.free-electrons.com/source/drivers/tty/vt/vt_ioctl.c?v=4.4#L399

ucval = KB_101;
ret = put_user(ucval, (char __user *)arg);

I've observed intermittent behavior related to this, and I can force an error condition by using an int initialized to 0xFFFFFFFF.  The resulting ioctl will set type to 0XFFFFFF02, and the conditional return in SDL_EVDEV_is_console() will fail.

Recommend changing to char, or masking off unused bits.
2017-01-05 23:26:13 -08:00
..
SDL_dbus.c Updated copyright for 2017 2017-01-01 18:33:28 -08:00
SDL_dbus.h Updated copyright for 2017 2017-01-01 18:33:28 -08:00
SDL_evdev.c Fixed bug 3546 - SDL_EVDEV_is_console() uses type of wrong size when calling ioctl 2017-01-05 23:26:13 -08:00
SDL_evdev.h Updated copyright for 2017 2017-01-01 18:33:28 -08:00
SDL_fcitx.c Updated copyright for 2017 2017-01-01 18:33:28 -08:00
SDL_fcitx.h Updated copyright for 2017 2017-01-01 18:33:28 -08:00
SDL_ibus.c Updated copyright for 2017 2017-01-01 18:33:28 -08:00
SDL_ibus.h Updated copyright for 2017 2017-01-01 18:33:28 -08:00
SDL_ime.c Updated copyright for 2017 2017-01-01 18:33:28 -08:00
SDL_ime.h Updated copyright for 2017 2017-01-01 18:33:28 -08:00
SDL_udev.c Updated copyright for 2017 2017-01-01 18:33:28 -08:00
SDL_udev.h Updated copyright for 2017 2017-01-01 18:33:28 -08:00