Skip to content

Commit

Permalink
Fixed bug 2562 - SDL_hapticlist/_tail not set correctly
Browse files Browse the repository at this point in the history
Zachary L

SDL_hapticlist and SDL_hapticlist_tail are not set correctly when quitting the subsystem. This matters because they are represented as global variables. In the case you quit and reinitialize the subsystems, problems with dangling pointers arise.

For instance, SDL_hapticlist_tail will not be null on second initialization and because of the check on line 298, it will fail to set SDL_hapticlist appropriately. This can cause a few things to go wrong, like feeding SDL_strcmp a null fname which can cause a segfault.
  • Loading branch information
slouken committed Jun 22, 2014
1 parent e8d84fb commit f8b75b1
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/haptic/linux/SDL_syshaptic.c
Expand Up @@ -624,6 +624,8 @@ SDL_SYS_HapticQuit(void)
#endif /* SDL_USE_LIBUDEV */

numhaptics = 0;
SDL_hapticlist = NULL;
SDL_hapticlist_tail = NULL;
}


Expand Down

0 comments on commit f8b75b1

Please sign in to comment.