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: press:
strncpy(_predictiveResult, prefix.c_str(), 40); Common::strlcpy(_predictiveResult, prefix.c_str(), sizeof(_predictiveResult));
strncat(_predictiveResult, _currentWord.c_str(), 40); Common::strlcat(_predictiveResult, _currentWord.c_str(), sizeof(_predictiveResult));
_predictiveResult[prefix.size() + _currentCode.size() + 1] = 0;
getout: getout:
// if another window was shown, bring it up again // if another window was shown, bring it up again