diff options
| author | Stelios Tsampas <loathingkernel@gmail.com> | 2017-07-20 13:04:40 +0300 |
|---|---|---|
| committer | Stelios Tsampas <loathingkernel@gmail.com> | 2017-07-20 13:04:40 +0300 |
| commit | db51fade6de9461e7a139da2bf5887a9a6569506 (patch) | |
| tree | f43878331e9abfd4f214cf60a06162854e4b75b3 /plugins/dfinput/pad.c | |
| parent | b6129143f75cf4480883e467d52627de949466fb (diff) | |
| download | pcsxr-db51fade6de9461e7a139da2bf5887a9a6569506.tar.gz | |
* dfinput: Fix possible buffer overflows in the ui.
Diffstat (limited to 'plugins/dfinput/pad.c')
| -rwxr-xr-x | plugins/dfinput/pad.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/plugins/dfinput/pad.c b/plugins/dfinput/pad.c index bd3aef73..8861ec4d 100755 --- a/plugins/dfinput/pad.c +++ b/plugins/dfinput/pad.c @@ -17,11 +17,15 @@ */ #include "pad.h" -#if !SDL_VERSION_ATLEAST(2,0,0) && defined(__linux__) +#if defined(__linux__) +#include <sys/types.h> +#include <sys/wait.h> +#if !SDL_VERSION_ATLEAST(2,0,0) #include <linux/input.h> #include <sys/file.h> #include <time.h> #endif +#endif #if SDL_VERSION_ATLEAST(2,0,0) int has_haptic; @@ -121,11 +125,13 @@ long PADopen(unsigned long *Disp) { } #if SDL_VERSION_ATLEAST(2,0,0) - SDL_InitSubSystem(SDL_INIT_GAMECONTROLLER); - - has_haptic = 0; - if (SDL_InitSubSystem(SDL_INIT_HAPTIC) == 0) - has_haptic = 1; + SDL_QuitSubSystem(SDL_INIT_JOYSTICK); + if (SDL_InitSubSystem(SDL_INIT_GAMECONTROLLER) == -1) + return PSE_PAD_ERR_FAILURE; + + has_haptic = 0; + if (SDL_InitSubSystem(SDL_INIT_HAPTIC) == 0) + has_haptic = 1; #endif InitSDLJoy(); |
