Check and reject too large physical block sizes.
This commit is contained in:
parent
dfdf600999
commit
6f64001927
2 changed files with 8 additions and 1 deletions
|
@ -6488,6 +6488,8 @@ static int pt_babe(TrapContext *ctx, uae_u8 *bufrdb, UnitInfo *uip, int unit_no,
|
|||
|
||||
bad = rl(bufrdb + 4);
|
||||
if (bad) {
|
||||
if (bad * hfd->ci.blocksize > FILESYS_MAX_BLOCKSIZE)
|
||||
return 0;
|
||||
hdf_read_rdb(hfd, bufrdb2, bad * hfd->ci.blocksize, hfd->ci.blocksize);
|
||||
if (bufrdb2[0] != 0xBA || bufrdb2[1] != 0xD1)
|
||||
return 0;
|
||||
|
@ -6749,6 +6751,11 @@ static int rdb_mount (TrapContext *ctx, UnitInfo *uip, int unit_no, int partnum,
|
|||
return -2;
|
||||
}
|
||||
|
||||
if (hfd->ci.blocksize > FILESYS_MAX_BLOCKSIZE) {
|
||||
write_log(_T("failed, too large block size %d\n"), hfd->ci.blocksize);
|
||||
return -2;
|
||||
}
|
||||
|
||||
for (rdblock = 0; rdblock < lastblock; rdblock++) {
|
||||
hdf_read_rdb (hfd, bufrdb, rdblock * hfd->ci.blocksize, hfd->ci.blocksize);
|
||||
if (rdblock == 0 && bufrdb[0] == 0xBA && bufrdb[1] == 0xBE) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue