aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorD G Turner2018-10-07 22:32:27 +0100
committerD G Turner2018-10-07 22:32:27 +0100
commit1f06cad15da1b6ec46dbfbdbcb650577922bb941 (patch)
tree770aab50708aa4cfa044880dca7b97d0e7c9217e
parent9c1dfe41aaecc01702ed5ff01c07d9ece5d8bb39 (diff)
downloadscummvm-rg350-1f06cad15da1b6ec46dbfbdbcb650577922bb941.tar.gz
scummvm-rg350-1f06cad15da1b6ec46dbfbdbcb650577922bb941.tar.bz2
scummvm-rg350-1f06cad15da1b6ec46dbfbdbcb650577922bb941.zip
DS: Fix Out Of Bounds Array Access Errors.
This is from bug Trac #10653.
-rw-r--r--backends/platform/ds/arm9/source/fat/gba_nds_fat.c6
1 files changed, 3 insertions, 3 deletions
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 76508a1664..1247b3f948 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] = ' ';
}