From 6f03de81c85ec1a9d8b0cfad170f8b2f04f497d1 Mon Sep 17 00:00:00 2001 From: Toni Wilen Date: Tue, 26 Feb 2019 19:55:25 +0200 Subject: [PATCH] Stop partition enumeration if there is no space in filesystem slots. --- filesys.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) 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; -- 2.47.3