]> git.unchartedbackwaters.co.uk Git - francis/winuae.git/commitdiff
Check and reject too large physical block sizes.
authorToni Wilen <twilen@winuae.net>
Fri, 31 Jan 2020 17:56:52 +0000 (19:56 +0200)
committerToni Wilen <twilen@winuae.net>
Fri, 31 Jan 2020 17:56:52 +0000 (19:56 +0200)
filesys.cpp
include/filesys.h

index cb2a77b37b71309c77ece5121e51d9a817b16368..f488f40185cb0c1b9a5c3ea0de08a02a69002d20 100644 (file)
@@ -8263,6 +8263,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;
@@ -8559,6 +8561,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) {
index 728c0f8ba2f42f040bdd649a2bb27ea81f7106bd..c2bc0883dbad72759350866697f90b44b32673c3 100644 (file)
@@ -127,7 +127,7 @@ extern struct uaedev_mount_info options_mountinfo;
 
 extern struct hardfiledata *get_hardfile_data(int nr);
 extern struct hardfiledata *get_hardfile_data_controller(int nr);
-#define FILESYS_MAX_BLOCKSIZE 2048
+#define FILESYS_MAX_BLOCKSIZE 8192
 extern int hdf_open (struct hardfiledata *hfd);
 extern int hdf_open (struct hardfiledata *hfd, const TCHAR *altname);
 extern int hdf_dup (struct hardfiledata *dhfd, const struct hardfiledata *shfd);