Stop the crash in cdvd detection when system.cnf is too big. Probably not the best way to implement it but it should work.

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@2232 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
gigaherz 2009-11-21 17:24:16 +00:00
parent 27c493ec9d
commit 7aae31db39
1 changed files with 5 additions and 4 deletions

View File

@ -31,6 +31,7 @@
#include "IsoFS/IsoFS.h" #include "IsoFS/IsoFS.h"
#include "IsoFS/IsoFSCDVD.h" #include "IsoFS/IsoFSCDVD.h"
#include "CDVDisoReader.h" #include "CDVDisoReader.h"
#include "Utilities/ScopedPtr.h"
const wxChar* CDVD_SourceLabels[] = const wxChar* CDVD_SourceLabels[] =
{ {
@ -77,14 +78,14 @@ static int CheckDiskTypeFS(int baseType)
int size = file.getLength(); int size = file.getLength();
char buffer[256]; //if the file is longer...it should be shorter :D ScopedArray<char> buffer((int)file.getLength()+1);
file.read((u8*)buffer,size); file.read((u8*)(buffer.GetPtr()),size);
buffer[size]='\0'; buffer[size]='\0';
char* pos = strstr(buffer, "BOOT2"); char* pos = strstr(buffer.GetPtr(), "BOOT2");
if (pos == NULL) if (pos == NULL)
{ {
pos = strstr(buffer, "BOOT"); pos = strstr(buffer.GetPtr(), "BOOT");
if (pos == NULL) return CDVD_TYPE_ILLEGAL; if (pos == NULL) return CDVD_TYPE_ILLEGAL;
return CDVD_TYPE_PSCD; return CDVD_TYPE_PSCD;
} }