From 941dec2c7c5674cc022c4a29bca0c7ccfbd41d69 Mon Sep 17 00:00:00 2001 From: Clownacy Date: Thu, 27 Jun 2019 17:50:19 +0000 Subject: [PATCH] Add a bugfix for unsafe usage of sprintf Thanks, Gabe --- src/TextScr.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/TextScr.cpp b/src/TextScr.cpp index 8200eeda..2669e7a0 100644 --- a/src/TextScr.cpp +++ b/src/TextScr.cpp @@ -1310,7 +1310,11 @@ int TextScriptProc() //Print text PutText2(0, 0, str, RGB(0xFF, 0xFF, 0xFE), (Surface_Ids)(gTS.line % 4 + SURFACE_ID_TEXT_LINE1)); - sprintf(&text[gTS.line % 4 * 0x40], str); + #ifdef FIX_BUGS + strcpy(&text[gTS.line % 4 * 0x40], str); + #else + sprintf(&text[gTS.line % 4 * 0x40], str); // No point to using an sprintf here, and it makes Clang mad + #endif //Check if should move to next line (prevent a memory overflow, come on guys, this isn't a leftover of pixel trying to make text wrapping) gTS.p_read += y;