From 2a6886d046f7875b9846ee83eebac1ed5655cd19 Mon Sep 17 00:00:00 2001 From: Allofich <19624336+Allofich@users.noreply.github.com> Date: Wed, 3 May 2023 21:22:44 +0900 Subject: [PATCH] Fix array-bounds warnings --- src/dos/drive_local.cpp | 2 +- src/ints/bios_disk.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/dos/drive_local.cpp b/src/dos/drive_local.cpp index 8bf2cd97c..81489ceff 100644 --- a/src/dos/drive_local.cpp +++ b/src/dos/drive_local.cpp @@ -344,7 +344,7 @@ template bool String_DBCS_TO_HOST_UTF8(char *d/*CROSS_LEN*/,const cha // TODO: This is SLOW. Optimize. template int SBCS_From_Host_Find(int c,const MT *map,const size_t map_max) { - if (morelen && (MT)c<0x20 && map[c] == cp437_to_unicode[c]) return c; + if (morelen && (MT)c<0x20 && c >= 0 && c < 256 && map[c] == cp437_to_unicode[c]) return c; for (size_t i=0;i < map_max;i++) { if ((MT)c == map[i]) return (int)i; diff --git a/src/ints/bios_disk.cpp b/src/ints/bios_disk.cpp index 1def13f54..aa8f1735b 100644 --- a/src/ints/bios_disk.cpp +++ b/src/ints/bios_disk.cpp @@ -500,7 +500,7 @@ struct fatFromDOSDrive ffddFile f; memcpy(f.path, dir, dirlen); memcpy(f.path + dirlen, dta_name, fend - dta_name + 1); - if (filter && filter->Get(f.path)) continue; + if (filter && filter->Get(f.path, sizeof(f.path))) continue; const bool isLongFileName = (!dot && !dotdot && !(dta_attr & DOS_ATTR_VOLUME)); if (isLongFileName)