Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed memory corruption in SDL_GetPreferredLocales()
Browse files Browse the repository at this point in the history
slouken committed Jul 24, 2024
1 parent 1f27c5e commit 4f7374d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/locale/SDL_locale.c
Original file line number Diff line number Diff line change
@@ -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) {

0 comments on commit 4f7374d

Please sign in to comment.