[Scummvm-git-logs] scummvm master -> 925c9416db8ae2361d8f444823621b869a1d210f

csnover csnover at users.noreply.github.com
Sat Nov 11 06:22:53 CET 2017


This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
a8eddb2fc4 SKY: Fix use of deallocated stack memory
925c9416db SWORD1: Fix use of deallocated stack memory


Commit: a8eddb2fc4d2aa29d306bc8ac7744c9c8bbb429b
    https://github.com/scummvm/scummvm/commit/a8eddb2fc4d2aa29d306bc8ac7744c9c8bbb429b
Author: Colin Snover (github.com at zetafleet.com)
Date: 2017-11-10T23:22:25-06:00

Commit Message:
SKY: Fix use of deallocated stack memory

FSNode::getName returns a String object, not a reference, so the
pointer from c_str is valid only until the end of the statement.

Changed paths:
    engines/sky/detection.cpp


diff --git a/engines/sky/detection.cpp b/engines/sky/detection.cpp
index 4b91f50..b5425f9 100644
--- a/engines/sky/detection.cpp
+++ b/engines/sky/detection.cpp
@@ -151,9 +151,7 @@ GameList SkyMetaEngine::detectGames(const Common::FSList &fslist) const {
 	// Iterate over all files in the given directory
 	for (Common::FSList::const_iterator file = fslist.begin(); file != fslist.end(); ++file) {
 		if (!file->isDirectory()) {
-			const char *fileName = file->getName().c_str();
-
-			if (0 == scumm_stricmp("sky.dsk", fileName)) {
+			if (0 == scumm_stricmp("sky.dsk", file->getName().c_str())) {
 				Common::File dataDisk;
 				if (dataDisk.open(*file)) {
 					hasSkyDsk = true;
@@ -161,7 +159,7 @@ GameList SkyMetaEngine::detectGames(const Common::FSList &fslist) const {
 				}
 			}
 
-			if (0 == scumm_stricmp("sky.dnr", fileName)) {
+			if (0 == scumm_stricmp("sky.dnr", file->getName().c_str())) {
 				Common::File dinner;
 				if (dinner.open(*file)) {
 					hasSkyDnr = true;


Commit: 925c9416db8ae2361d8f444823621b869a1d210f
    https://github.com/scummvm/scummvm/commit/925c9416db8ae2361d8f444823621b869a1d210f
Author: Colin Snover (github.com at zetafleet.com)
Date: 2017-11-10T23:22:26-06:00

Commit Message:
SWORD1: Fix use of deallocated stack memory

FSNode::getName returns a String object, not a reference, so the
pointer from c_str is valid only until the end of the statement.

Changed paths:
    engines/sword1/detection.cpp


diff --git a/engines/sword1/detection.cpp b/engines/sword1/detection.cpp
index 53ddfca..d4343c8 100644
--- a/engines/sword1/detection.cpp
+++ b/engines/sword1/detection.cpp
@@ -161,9 +161,8 @@ void Sword1CheckDirectory(const Common::FSList &fslist, bool *filesFound, bool r
 			if (directory.hasPrefix("clusters") && directory.size() <= 9 && !recursion)
 				continue;
 
-			const char *fileName = file->getName().c_str();
 			for (int cnt = 0; cnt < NUM_FILES_TO_CHECK; cnt++)
-				if (scumm_stricmp(fileName, g_filesToCheck[cnt]) == 0)
+				if (scumm_stricmp(file->getName().c_str(), g_filesToCheck[cnt]) == 0)
 					filesFound[cnt] = true;
 		} else {
 			for (int cnt = 0; cnt < ARRAYSIZE(g_dirNames); cnt++)





More information about the Scummvm-git-logs mailing list