Commit eb98ff47405c519f04ab25a0a7c257b3d752d3ab

Cameron Gutman 2021-11-13T13:05:02

testmessage: Fix overread of stack variable

diff --git a/test/testmessage.c b/test/testmessage.c
index b10ab70..a179b77 100644
--- a/test/testmessage.c
+++ b/test/testmessage.c
@@ -61,9 +61,9 @@ button_messagebox(void *eventNumber)
     if (success == -1) {
         SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Error Presenting MessageBox: %s\n", SDL_GetError());
         if (eventNumber) {
-            SDL_UserEvent event;
+            SDL_Event event;
             event.type = (intptr_t)eventNumber;
-            SDL_PushEvent((SDL_Event*)&event);
+            SDL_PushEvent(&event);
             return 1;
         } else {
             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");
 
     if (eventNumber) {
-        SDL_UserEvent event;
+        SDL_Event event;
         event.type = (intptr_t)eventNumber;
-        SDL_PushEvent((SDL_Event*)&event);
+        SDL_PushEvent(&event);
     }
 
     return 0;