From: Toni Wilen Date: Tue, 26 Feb 2019 17:55:25 +0000 (+0200) Subject: Stop partition enumeration if there is no space in filesystem slots. X-Git-Tag: 4200~36 X-Git-Url: https://git.unchartedbackwaters.co.uk/w/?a=commitdiff_plain;h=6f03de81c85ec1a9d8b0cfad170f8b2f04f497d1;p=francis%2Fwinuae.git Stop partition enumeration if there is no space in filesystem slots. --- diff --git a/filesys.cpp b/filesys.cpp index 4b0fee3d..65d917dd 100644 --- a/filesys.cpp +++ b/filesys.cpp @@ -8747,13 +8747,17 @@ static int dofakefilesys (TrapContext *ctx, UnitInfo *uip, uaecptr parmpacket, s /* Fill in per-unit fields of a parampacket */ static uae_u32 REGPARAM2 filesys_dev_storeinfo (TrapContext *ctx) { - UnitInfo *uip = mountinfo.ui; int no = trap_get_dreg(ctx, 6) & 0x7fffffff; int unit_no = no & 65535; int sub_no = no >> 16; - int iscd = (trap_get_dreg(ctx, 6) & 0x80000000) != 0 || uip[unit_no].unit_type == UNIT_CDFS; int type; + + if (unit_no >= MAX_FILESYSTEM_UNITS) + return -2; + + UnitInfo *uip = mountinfo.ui; uaecptr parmpacket = trap_get_areg(ctx, 0); + int iscd = (trap_get_dreg(ctx, 6) & 0x80000000) != 0 || uip[unit_no].unit_type == UNIT_CDFS; struct uaedev_config_info *ci = &uip[unit_no].hf.ci; uip[unit_no].parmpacket = parmpacket;