From efa4c7e2c7c961123c8476fc99d1f45b774fea04 Mon Sep 17 00:00:00 2001 From: Matthias Braun Date: Sun, 18 May 2008 12:01:30 +0000 Subject: [PATCH] fix crash when filename is shorter than extension length SVN-Revision: 5489 --- src/addon/addon_manager.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/addon/addon_manager.cpp b/src/addon/addon_manager.cpp index 4a783d8cb..68a50c557 100644 --- a/src/addon/addon_manager.cpp +++ b/src/addon/addon_manager.cpp @@ -385,7 +385,11 @@ AddonManager::load_addons() // make sure it looks like an infoFile static const std::string infoExt = ".nfo"; - if (potentialInfoFileName.compare(potentialInfoFileName.length()-infoExt.length(), infoExt.length(), infoExt) != 0) continue; + if (potentialInfoFileName.length() <= infoExt.length()) + continue; + + if (potentialInfoFileName.compare(potentialInfoFileName.length()-infoExt.length(), infoExt.length(), infoExt) != 0) + continue; // make sure it's in the current archive std::string infoFileDir = PHYSFS_getRealDir(potentialInfoFileName.c_str()); -- 2.11.0