mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-09-05 19:08:12 +00:00
Fixed memory corruption in SDL_GetPreferredLocales()
Fixes https://github.com/libsdl-org/SDL/issues/10362
This commit is contained in:
@@ -50,7 +50,7 @@ static const SDL_Locale * const *build_locales_from_csv_string(char *csv, int *c
|
||||
}
|
||||
|
||||
slen = ((size_t)(ptr - csv)) + 1; /* SDL_strlen(csv) + 1 */
|
||||
alloclen = (num_locales * sizeof(SDL_Locale *)) + (num_locales * sizeof(SDL_Locale)) + slen;
|
||||
alloclen = ((num_locales + 1) * sizeof(SDL_Locale *)) + (num_locales * sizeof(SDL_Locale)) + slen;
|
||||
|
||||
retval = (SDL_Locale **)SDL_calloc(1, alloclen);
|
||||
if (!retval) {
|
||||
|
Reference in New Issue
Block a user