Ensure that long game titles are NUL-terminated

This commit is contained in:
entropy 2012-03-11 15:40:56 +00:00
parent 343e988de0
commit cc78e4cae7

View File

@ -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;
}