Skip to content

Commit

Permalink
Fix invalid read from poor setlocale usage.
Browse files Browse the repository at this point in the history
  • Loading branch information
baines committed Oct 3, 2016
1 parent aae28e3 commit d9e3972
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/video/x11/SDL_x11video.c
Expand Up @@ -399,6 +399,10 @@ X11_VideoInit(_THIS)
const char *env_xmods = SDL_getenv("XMODIFIERS");
SDL_bool has_dbus_ime_support = SDL_FALSE;

if (prev_locale) {
prev_locale = SDL_strdup(prev_locale);
}

if (prev_xmods) {
prev_xmods = SDL_strdup(prev_xmods);
}
Expand Down Expand Up @@ -431,6 +435,10 @@ X11_VideoInit(_THIS)
setlocale(LC_ALL, prev_locale);
X11_XSetLocaleModifiers(prev_xmods);

if (prev_locale) {
SDL_free(prev_locale);
}

if (prev_xmods) {
SDL_free(prev_xmods);
}
Expand Down

0 comments on commit d9e3972

Please sign in to comment.