From 197e68ef2ac0af202046130a7af7ef4f32aa831f Mon Sep 17 00:00:00 2001 From: Max Horn Date: Tue, 1 Sep 2009 13:01:59 +0000 Subject: SCUMM: Better fix for convertFilePath (use snprintf instead of sprintf, avoid intermediate buffer) svn-id: r43879 --- engines/scumm/he/script_v60he.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'engines/scumm') diff --git a/engines/scumm/he/script_v60he.cpp b/engines/scumm/he/script_v60he.cpp index 0048160980..8ade78c1b5 100644 --- a/engines/scumm/he/script_v60he.cpp +++ b/engines/scumm/he/script_v60he.cpp @@ -122,10 +122,8 @@ int ScummEngine_v60he::convertFilePath(byte *dst, int dstSize) { int r = 0; if (dst[len - 3] == 's' && dst[len - 2] == 'g') { // Save Game File // Change filename prefix to target name, for save game files. - char saveName[40]; - memset(saveName, 0, sizeof(saveName)); - sprintf(saveName, "%s.sg%c", _targetName.c_str(), dst[len - 1]); - memcpy(dst, saveName, 40); + const char c = dst[len - 1]; + snprintf((char *)dst, dstSize, "%s.sg%c", _targetName.c_str(), c); } else if (dst[0] == '.' && dst[1] == '/') { // Game Data Path // The default game data path is set to './' by ScummVM r = 2; -- cgit v1.2.3