mirror of
https://github.com/holub/mame
synced 2025-07-03 17:08:39 +03:00
Adding a check for reverse overflow when extensions is longer than filename
This commit is contained in:
parent
0e4cb93bc5
commit
32230ae648
@ -1300,8 +1300,8 @@ bool core_filename_ends_with(const std::string &filename, const std::string &ext
|
|||||||
auto extlen = extension.length();
|
auto extlen = extension.length();
|
||||||
bool matches = true;
|
bool matches = true;
|
||||||
|
|
||||||
/* work backwards checking for a match */
|
// work backwards checking for a match
|
||||||
while (extlen > 0)
|
while (extlen > 0 && namelen > 0)
|
||||||
if (tolower((UINT8)filename[--namelen]) != tolower((UINT8)extension[--extlen]))
|
if (tolower((UINT8)filename[--namelen]) != tolower((UINT8)extension[--extlen]))
|
||||||
{
|
{
|
||||||
matches = false;
|
matches = false;
|
||||||
|
Loading…
Reference in New Issue
Block a user