From cc78e4cae751821c9c472dd7b30d515f55810797 Mon Sep 17 00:00:00 2001 From: entropy Date: Sun, 11 Mar 2012 15:40:56 +0000 Subject: [PATCH] Ensure that long game titles are NUL-terminated --- source/gui/GameTDB.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/source/gui/GameTDB.cpp b/source/gui/GameTDB.cpp index 4300dfc1..0d6b97ab 100644 --- a/source/gui/GameTDB.cpp +++ b/source/gui/GameTDB.cpp @@ -480,7 +480,8 @@ bool GameTDB::FindTitle(char * data, string & title, string langCode) } char tmp[64]; - strncpy(tmp, the_title, 64); + strncpy(tmp, the_title, sizeof(tmp) - 1); + tmp[sizeof(tmp) - 1] = '\0'; title=tmp; return true; }