From 7137e1fc055d5e6a029e8f082dd1ea814a543574 Mon Sep 17 00:00:00 2001 From: Adrien Destugues Date: Wed, 11 Jan 2012 18:29:46 +0000 Subject: [PATCH] Strings with more than 24 chars were not properly null-terminated before sending them to Print_in_menu, causing random data to appear in the status bar since Print_in_menu will print more chars if there's space. Thanks to DawnBringer for noticing! git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@1899 416bcca6-2ee7-4201-b75f-2eb2f807beb1 --- src/factory.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/factory.c b/src/factory.c index 80757f7f..78e6345f 100644 --- a/src/factory.c +++ b/src/factory.c @@ -1333,12 +1333,12 @@ int L_StatusMessage(lua_State* L) // fill remainder with spaces for (;len<24;len++) msg2[len]=' '; - msg2[24]='\0'; } else { strncpy(msg2, msg, 24); } + msg2[24]='\0'; Print_in_menu(msg2,0); return 0; }