mirror of
https://github.com/dborth/vbagx.git
synced 2024-11-22 10:39:18 +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
633bca15af
commit
85217f4c0d
@ -871,6 +871,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);
|
||||
}
|
||||
|
||||
|
@ -18,7 +18,7 @@
|
||||
#include <fat.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#define SAVEBUFFERSIZE (1024 * 512)
|
||||
#define SAVEBUFFERSIZE (1024 * 1024 * 2) // leave room for IPS/UPS files and larger images
|
||||
|
||||
void InitDeviceThread();
|
||||
void ResumeDeviceThread();
|
||||
|
Loading…
Reference in New Issue
Block a user