summaryrefslogtreecommitdiff
path: root/plugins/AssocMgr
diff options
context:
space:
mode:
authorSzymon Tokarz <wsx22@o2.pl>2013-12-21 12:03:28 +0000
committerSzymon Tokarz <wsx22@o2.pl>2013-12-21 12:03:28 +0000
commitffac161fc2309f15343a6251840a7023027ab0e5 (patch)
tree1110fef1352d17b676dd9ddd1f93811580c4642f /plugins/AssocMgr
parent95150194744ca17d0f56382298e5e9cf715ad6ff (diff)
Association Manager
- try to fix wired logic at CleanupRegTreeBackupSettings() - fix pszClassName use after free - fix cleanup if more than one class exists into bak_ ppszSettings git-svn-id: http://svn.miranda-ng.org/main/trunk@7315 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/AssocMgr')
-rw-r--r--plugins/AssocMgr/src/reg.cpp27
1 files changed, 17 insertions, 10 deletions
diff --git a/plugins/AssocMgr/src/reg.cpp b/plugins/AssocMgr/src/reg.cpp
index 8936ab14e2..9737094980 100644
--- a/plugins/AssocMgr/src/reg.cpp
+++ b/plugins/AssocMgr/src/reg.cpp
@@ -546,20 +546,27 @@ void CleanupRegTreeBackupSettings(void)
char *pszBuf = strchr(pszClassName,'\\');
if (pszBuf != NULL) {
*pszBuf = '\0';
+
/* remove others in list with same class name */
- for(int j=i; j < nSettingsCount; ++j) {
- pszBuf = strchr(&ppszSettings[j][4],'\\');
- if (pszBuf != NULL) *pszBuf='\0';
- if ( lstrcmpA(pszClassName, &ppszSettings[j][4])) continue;
-
- mir_free(ppszSettings[j]);
- MoveMemory(&ppszSettings[j],&ppszSettings[j+1],((--nSettingsCount)-j)*sizeof(TCHAR*));
- --j; /* reiterate current index */
+ if(i < nSettingsCount-1){
+ for(int j=i+1; j < nSettingsCount; ++j) {
+ pszBuf = strchr(&ppszSettings[j][4],'\\');
+ if (pszBuf != NULL) *pszBuf='\0';
+ if (lstrcmpA(pszClassName, &ppszSettings[j][4])){
+ if (pszBuf != NULL) *pszBuf='\\';
+ continue;
+ }
+
+ mir_free(ppszSettings[j]);
+ MoveMemory(&ppszSettings[j], &ppszSettings[j+1], ((--nSettingsCount)-j) * sizeof(char*));
+ --j; /* reiterate current index */
+ }
}
+
/* no longer registered? */
- if ( !IsRegisteredAssocItem(pszClassName)) {
+ if (!IsRegisteredAssocItem(pszClassName)) {
char *pszFileExt;
- if ( IsFileClassName(pszClassName, &pszFileExt))
+ if (IsFileClassName(pszClassName, &pszFileExt))
RemoveRegFileExt(pszFileExt, pszClassName);
else
RemoveRegClass(pszClassName);