From f691cadfc14ef8a358e9b9409a4f8b58f3348d0e Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 5 Nov 2011 17:38:41 +0100 Subject: HUGO: Fix a CppCheck warning reported by Tetsuo55 --- engines/hugo/schedule.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'engines/hugo/schedule.cpp') diff --git a/engines/hugo/schedule.cpp b/engines/hugo/schedule.cpp index 384b3ace8f..6a4fd88354 100644 --- a/engines/hugo/schedule.cpp +++ b/engines/hugo/schedule.cpp @@ -1540,6 +1540,8 @@ void Scheduler_v1d::promptAction(act *action) { char resp[256]; strncpy(resp, response.c_str(), 256); + if (response.size() > 256) + resp[255] = '\0'; if (action->a3.encodedFl) decodeString(resp); @@ -1587,6 +1589,8 @@ void Scheduler_v2d::promptAction(act *action) { char resp[256]; strncpy(resp, response.c_str(), 256); + if (response.size() > 256) + resp[255] = '\0'; for (int dx = 0; !found && (action->a3.responsePtr[dx] != -1); dx++) { tmpStr = _vm->_file->fetchString(action->a3.responsePtr[dx]); -- cgit v1.2.3