mirror of
https://github.com/dborth/snes9xgx.git
synced 2025-02-17 11:56:25 +01:00
prevent overrunning the file buffer (eg: loading a game cover image
that's too big). increase buffer size to load larger IPS/UPS files.
This commit is contained in:
parent
0533d181a3
commit
b4757544c9
@ -863,6 +863,18 @@ LoadFile (char * rbuffer, char *filepath, size_t length, bool silent)
|
||||
|
||||
size_t LoadFile(char * filepath, bool silent)
|
||||
{
|
||||
struct stat filestat;
|
||||
|
||||
if(stat(filepath, &filestat) != 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int size = filestat.st_size;
|
||||
|
||||
if(size >= SAVEBUFFERSIZE) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return LoadFile((char *)savebuffer, filepath, 0, silent);
|
||||
}
|
||||
|
||||
|
@ -21,7 +21,7 @@
|
||||
#include <fat.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#define SAVEBUFFERSIZE (1024 * 512)
|
||||
#define SAVEBUFFERSIZE (1024 * 1024 * 2) // leave room for IPS/UPS files and large images
|
||||
|
||||
void InitDeviceThread();
|
||||
void ResumeDeviceThread();
|
||||
|
Loading…
x
Reference in New Issue
Block a user