From: John Hodge (sonata) Date: Sat, 9 Feb 2013 09:59:50 +0000 (+0800) Subject: Modules/FDDv2 - Minor fix in ReadDir/FindDir X-Git-Tag: rel0.15~583 X-Git-Url: https://git.ucc.asn.au/?p=tpg%2Facess2.git;a=commitdiff_plain;h=999c52541676db68eb1bcb6c5b64d352502df77b Modules/FDDv2 - Minor fix in ReadDir/FindDir --- diff --git a/KernelLand/Modules/Storage/FDDv2/main.c b/KernelLand/Modules/Storage/FDDv2/main.c index 90cff7f4..bb088da1 100644 --- a/KernelLand/Modules/Storage/FDDv2/main.c +++ b/KernelLand/Modules/Storage/FDDv2/main.c @@ -113,7 +113,7 @@ int FDD_RegisterFS(void) */ int FDD_ReadDir(tVFS_Node *Node, int Pos, char Dest[FILENAME_MAX]) { - if(Pos < 0 || Pos > MAX_DISKS ) + if(Pos < 0 || Pos >= MAX_DISKS ) return -ENOENT; if(!gaFDD_Disks[Pos].bValid) return 1; @@ -136,6 +136,7 @@ tVFS_Node *FDD_FindDir(tVFS_Node *Node, const char *Name) if( Name[1] != '\0' ) return NULL; pos = Name[0] - '0'; + if( pos >= MAX_DISKS ) return NULL; return &gaFDD_DiskNodes[pos]; }