From 28bd3e0af8e2f545d57648b8fe991767fe2b5abe Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sat, 15 Nov 2008 14:15:17 +0000 Subject: Fixed strncpy usage. svn-id: r35083 --- engines/scumm/scumm.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'engines/scumm') diff --git a/engines/scumm/scumm.cpp b/engines/scumm/scumm.cpp index 93605fa29b..ddae3141c4 100644 --- a/engines/scumm/scumm.cpp +++ b/engines/scumm/scumm.cpp @@ -2343,7 +2343,9 @@ void ScummEngine::errorString(const char *buf1, char *buf2, int buf2Size) { snprintf(buf2, buf2Size, "(%d:%d:0x%lX): %s", _roomResource, vm.slot[_currentScript].number, (long)(_scriptPointer - _scriptOrgPointer), buf1); } else { - strcpy(buf2, buf1); + strncpy(buf2, buf1, buf2Size); + if (buf2Size > 0) + buf2[buf2Size-1] = '\0'; } } -- cgit v1.2.3