From 32c19b9dc8c229e239434fedc94541c6abb3f84a Mon Sep 17 00:00:00 2001 From: Anonymous Maarten Date: Mon, 25 May 2026 14:16:01 +0200 Subject: [PATCH] Fix buffer-overflow access in process_testStdinToStdout Backing memory of SDL_IOFromDynamicMem is not null-terminated. --- test/testprocess.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/testprocess.c b/test/testprocess.c index d21a42a6aa..3fa56d0376 100644 --- a/test/testprocess.c +++ b/test/testprocess.c @@ -500,7 +500,8 @@ static int process_testStdinToStdout(void *arg) total_read += amount_read; SDL_WriteIO(stdout_stream, local_buffer, amount_read); stdout_stream_buf = SDL_GetPointerProperty(SDL_GetIOProperties(stdout_stream), SDL_PROP_IOSTREAM_DYNAMIC_MEMORY_POINTER, NULL); - if (SDL_strstr(stdout_stream_buf, "EOF")) { + Sint64 stdout_size = SDL_GetIOSize(stdout_stream); + if (SDL_strnstr(stdout_stream_buf, "EOF", (size_t)stdout_size)) { SDLTest_Log("Found EOF in stdout"); break; }