summaryrefslogtreecommitdiffstatshomepage
path: root/src/lib/util/corefile.cpp
diff options
context:
space:
mode:
author Nathan Woods <npwoods@mess.org>2016-07-11 10:46:36 -0400
committer Nathan Woods <npwoods@mess.org>2016-07-11 10:46:36 -0400
commit32230ae6485f76c7d0745c3e981a6aa14d4e0be0 (patch)
tree1a45bf05cddc625b6235fdbe840aca282688c139 /src/lib/util/corefile.cpp
parent0e4cb93bc58d8b598bee9ff4ea6e5949853fadeb (diff)
Adding a check for reverse overflow when extensions is longer than filename
Diffstat (limited to 'src/lib/util/corefile.cpp')
-rw-r--r--src/lib/util/corefile.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/lib/util/corefile.cpp b/src/lib/util/corefile.cpp
index 0fe87f15982..5c530b41f30 100644
--- a/src/lib/util/corefile.cpp
+++ b/src/lib/util/corefile.cpp
@@ -1300,8 +1300,8 @@ bool core_filename_ends_with(const std::string &filename, const std::string &ext
auto extlen = extension.length();
bool matches = true;
- /* work backwards checking for a match */
- while (extlen > 0)
+ // work backwards checking for a match
+ while (extlen > 0 && namelen > 0)
if (tolower((UINT8)filename[--namelen]) != tolower((UINT8)extension[--extlen]))
{
matches = false;