testmessage: Fix overread of stack variable

This commit is contained in:
Cameron Gutman 2021-11-13 13:05:02 -06:00
parent fbe810070b
commit eb98ff4740
1 changed files with 4 additions and 4 deletions

View File

@ -61,9 +61,9 @@ button_messagebox(void *eventNumber)
if (success == -1) { if (success == -1) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Error Presenting MessageBox: %s\n", SDL_GetError()); SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Error Presenting MessageBox: %s\n", SDL_GetError());
if (eventNumber) { if (eventNumber) {
SDL_UserEvent event; SDL_Event event;
event.type = (intptr_t)eventNumber; event.type = (intptr_t)eventNumber;
SDL_PushEvent((SDL_Event*)&event); SDL_PushEvent(&event);
return 1; return 1;
} else { } else {
quit(2); quit(2);
@ -72,9 +72,9 @@ button_messagebox(void *eventNumber)
SDL_Log("Pressed button: %d, %s\n", button, button == -1 ? "[closed]" : button == 1 ? "Cancel" : "OK"); SDL_Log("Pressed button: %d, %s\n", button, button == -1 ? "[closed]" : button == 1 ? "Cancel" : "OK");
if (eventNumber) { if (eventNumber) {
SDL_UserEvent event; SDL_Event event;
event.type = (intptr_t)eventNumber; event.type = (intptr_t)eventNumber;
SDL_PushEvent((SDL_Event*)&event); SDL_PushEvent(&event);
} }
return 0; return 0;