CD-i: Buffer overflow fix + Initial default NvRAM (#1106)
* CD-i: Fixed buffer overflow Fixed reintroduction of the buffer overflow by commit1addb89ffOriginally was fixed withc0171c9but not yet well understood. * CD-i: Mount root folder NvRAM after core load Instead of starting with an empty NvRAM, "saves/CD-i/CD-i.sav" will be loaded instead. Avoids machine reset by NvRAM change in case a root folder CD image shall be used
This commit is contained in:
11
user_io.cpp
11
user_io.cpp
@@ -1552,6 +1552,7 @@ void user_io_init(const char *path, const char *xml)
|
||||
const char *home = HomeDir();
|
||||
|
||||
if (is_uneon()) x86_ide_set();
|
||||
if (is_cdi()) cdi_load_root_nvram();
|
||||
|
||||
if (!strlen(path) || !user_io_file_tx(path, 0, 0, 0, 1))
|
||||
{
|
||||
@@ -3107,7 +3108,7 @@ void user_io_poll()
|
||||
int disk = -1;
|
||||
int ack = 0;
|
||||
int op = 0;
|
||||
static uint8_t buffer[16][16384];
|
||||
static uint8_t buffer[16][UIO_BUFFER_SIZE];
|
||||
uint64_t lba = 0;
|
||||
uint32_t blksz, blks, sz;
|
||||
|
||||
@@ -3130,7 +3131,7 @@ void user_io_poll()
|
||||
if (disk == 1 && is_psx())
|
||||
blksz = 2352;
|
||||
else if (disk == 0 && is_cdi())
|
||||
blksz = (2352 + 24);
|
||||
blksz = CDI_CDIC_BUFFER_SIZE;
|
||||
else
|
||||
blksz = 128 << ((c >> 6) & 7);
|
||||
|
||||
@@ -3265,11 +3266,11 @@ void user_io_poll()
|
||||
unsigned int psx_blksz = psx_chd_hunksize();
|
||||
if (psx_blksz && psx_blksz <= sizeof(buffer[0])) buf_n = psx_blksz / blksz;
|
||||
}
|
||||
else if (is_cdi() && blksz == (2352 + 24))
|
||||
else if (is_cdi() && blksz == CDI_CDIC_BUFFER_SIZE)
|
||||
{
|
||||
//returns 0 if the mounted disk is not a chd, otherwise returns the chd hunksize in bytes
|
||||
unsigned int psx_blksz = cdi_chd_hunksize();
|
||||
if (psx_blksz && psx_blksz <= sizeof(buffer[0])) buf_n = psx_blksz / blksz;
|
||||
unsigned int cdi_blksz = cdi_chd_hunksize();
|
||||
if (cdi_blksz && cdi_blksz <= sizeof(buffer[0])) buf_n = cdi_blksz / blksz;
|
||||
}
|
||||
//printf("SD RD (%llu,%d) on %d, WIDE=%d\n", lba, blksz, disk, fio_size);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user