[Scummvm-git-logs] scummvm master -> 1f06cad15da1b6ec46dbfbdbcb650577922bb941

digitall dgturner at iee.org
Sun Oct 7 23:46:54 CEST 2018


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

Summary:
1f06cad15d DS: Fix Out Of Bounds Array Access Errors.


Commit: 1f06cad15da1b6ec46dbfbdbcb650577922bb941
    https://github.com/scummvm/scummvm/commit/1f06cad15da1b6ec46dbfbdbcb650577922bb941
Author: D G Turner (digitall at scummvm.org)
Date: 2018-10-07T22:32:27+01:00

Commit Message:
DS: Fix Out Of Bounds Array Access Errors.

This is from bug Trac #10653.

Changed paths:
    backends/platform/ds/arm9/source/fat/gba_nds_fat.c


diff --git a/backends/platform/ds/arm9/source/fat/gba_nds_fat.c b/backends/platform/ds/arm9/source/fat/gba_nds_fat.c
index 76508a1..1247b3f 100644
--- a/backends/platform/ds/arm9/source/fat/gba_nds_fat.c
+++ b/backends/platform/ds/arm9/source/fat/gba_nds_fat.c
@@ -1460,7 +1460,7 @@ DIR_ENT FAT_DirEntFromPath (const char* path)
 		{
 			// Match filename
 			found = true;
-			for (namePos = 0; (namePos < MAX_FILENAME_LENGTH) && found && (name[namePos] != '\0') && (lfnName[namePos] != '\0'); namePos++)
+			for (namePos = 0; (namePos < MAX_FILENAME_LENGTH-1) && found && (name[namePos] != '\0') && (lfnName[namePos] != '\0'); namePos++)
 			{
 				if (name[namePos] != ucase(lfnName[namePos]))
 				{
@@ -1477,7 +1477,7 @@ DIR_ENT FAT_DirEntFromPath (const char* path)
 			{
 				FAT_GetFilename(dirEntry, alias);
 				found = true;
-				for (namePos = 0; (namePos < 13) && found && (name[namePos] != '\0') && (alias[namePos] != '\0'); namePos++)
+				for (namePos = 0; (namePos < (sizeof(alias)/sizeof(alias[0]))-1) && found && (name[namePos] != '\0') && (alias[namePos] != '\0'); namePos++)
 				{
 					if (name[namePos] != ucase(alias[namePos]))
 					{
@@ -3186,7 +3186,7 @@ int FAT_mkdir (const char* path)
 	// Create . directory entry
 	dirEntry.name[0] = '.';
 	// Fill name and extension with spaces
-	for (i = 1; i < 11; i++)
+	for (i = 1; i < (sizeof(name)/sizeof(name[0])); i++)
 	{
 		dirEntry.name[i] = ' ';
 	}





More information about the Scummvm-git-logs mailing list