Permalink
Browse files

DS: Fix Out Of Bounds Array Access Errors.

This is from bug Trac #10653.
  • Loading branch information...
digitall committed Oct 7, 2018
1 parent 9c1dfe4 commit 1f06cad15da1b6ec46dbfbdbcb650577922bb941
Showing with 3 additions and 3 deletions.
  1. +3 −3 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] = ' ';
}

0 comments on commit 1f06cad

Please sign in to comment.