From: <sag...@us...> - 2010-03-12 23:35:23
|
Revision: 526 http://modplug.svn.sourceforge.net/modplug/?rev=526&view=rev Author: saga-games Date: 2010-03-12 23:35:13 +0000 (Fri, 12 Mar 2010) Log Message: ----------- [Fix] Treeview: A crash could occour if the instrument library path was too long (f.e. because of malicious strings in the [Paths] section of the INI file) [Imp] Treeview: J2B files were not shown in treeview. [Ref] Added portable mode flag to CTrackApp class. Modified Paths: -------------- trunk/OpenMPT/mptrack/Mptrack.cpp trunk/OpenMPT/mptrack/Mptrack.h trunk/OpenMPT/mptrack/View_tre.cpp Modified: trunk/OpenMPT/mptrack/Mptrack.cpp =================================================================== --- trunk/OpenMPT/mptrack/Mptrack.cpp 2010-03-12 18:28:00 UTC (rev 525) +++ trunk/OpenMPT/mptrack/Mptrack.cpp 2010-03-12 23:35:13 UTC (rev 526) @@ -845,6 +845,7 @@ strcpy(m_szPluginCacheFileName, m_szConfigDirectory); // plugin cache strcat(m_szPluginCacheFileName, "plugin.cache"); + m_bPortableMode = bIsAppDir; } BOOL CTrackApp::InitInstance() Modified: trunk/OpenMPT/mptrack/Mptrack.h =================================================================== --- trunk/OpenMPT/mptrack/Mptrack.h 2010-03-12 18:28:00 UTC (rev 525) +++ trunk/OpenMPT/mptrack/Mptrack.h 2010-03-12 23:35:13 UTC (rev 526) @@ -158,6 +158,7 @@ TCHAR m_szConfigFileName[_MAX_PATH]; TCHAR m_szPluginCacheFileName[_MAX_PATH]; TCHAR m_szStringsFileName[_MAX_PATH]; + bool m_bPortableMode; #ifdef UPDATECHECKENABLED // Internet request context @@ -201,6 +202,7 @@ BOOL IsWaveExEnabled() const { return m_bExWaveSupport; } BOOL IsDebug() const { return m_bDebugMode; } LPCSTR GetConfigFileName() const { return m_szConfigFileName; } + bool IsPortableMode() const { return m_bPortableMode; } LPCSTR GetPluginCacheFileName() const { return m_szPluginCacheFileName; } LPCSTR GetConfigPath() const { return m_szConfigDirectory; } void SetupPaths(); Modified: trunk/OpenMPT/mptrack/View_tre.cpp =================================================================== --- trunk/OpenMPT/mptrack/View_tre.cpp 2010-03-12 18:28:00 UTC (rev 525) +++ trunk/OpenMPT/mptrack/View_tre.cpp 2010-03-12 23:35:13 UTC (rev 526) @@ -1615,8 +1615,14 @@ } } } + + // The path is too long - we can't continue. This can actually only happen with an invalid path + if(strlen(szPath) >= ARRAYELEMCOUNT(szPath) - 1) + return; + // Enumerating Directories and samples/instruments - if (szPath[strlen(szPath)-1] != '\\') strcat(szPath, "\\"); + if (szPath[strlen(szPath) - 1] != '\\') + strcat(szPath, "\\"); strcpy(m_szInstrLibPath, szPath); strcat(szPath, "*.*"); memset(&wfd, 0, sizeof(wfd)); @@ -1701,6 +1707,7 @@ || (!lstrcmpi(s, ".wow")) || (!lstrcmpi(s, ".gdm")) || (!lstrcmpi(s, ".imf")) + || (!lstrcmpi(s, ".j2b")) #ifndef NO_MO3_SUPPORT || (!lstrcmpi(s, ".mo3")) #endif This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |