AGI: Fix possible buffer overflow.

This is based on patch #3085298 "overflows in agi and parallaction".

svn-id: r53147
This commit is contained in:
Johannes Schickel 2010-10-11 17:07:53 +00:00
parent c3366755ef
commit cc0afa92b3

View File

@ -461,9 +461,8 @@ bool AgiEngine::predictiveDialog() {
}
press:
strncpy(_predictiveResult, prefix.c_str(), 40);
strncat(_predictiveResult, _currentWord.c_str(), 40);
_predictiveResult[prefix.size() + _currentCode.size() + 1] = 0;
Common::strlcpy(_predictiveResult, prefix.c_str(), sizeof(_predictiveResult));
Common::strlcat(_predictiveResult, _currentWord.c_str(), sizeof(_predictiveResult));
getout:
// if another window was shown, bring it up again