Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Niefer2008-04-18 11:03:20 -0400
committerAndrew Niefer2008-04-18 11:03:20 -0400
commit5ae13f8559d75e1349de8b818b44e4ab5f6364cb (patch)
tree7d6c072bd19fc6c7a680b55f00d897ea1e0db6ca /bundles
parent47f91c56dcdee4f8ee1e3097e70fcc9c0c1dc2de (diff)
downloadrt.equinox.framework-5ae13f8559d75e1349de8b818b44e4ab5f6364cb.tar.gz
rt.equinox.framework-5ae13f8559d75e1349de8b818b44e4ab5f6364cb.tar.xz
rt.equinox.framework-5ae13f8559d75e1349de8b818b44e4ab5f6364cb.zip
bug 227232 - memory corruption
Diffstat (limited to 'bundles')
-rw-r--r--bundles/org.eclipse.equinox.executable/library/eclipse.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/bundles/org.eclipse.equinox.executable/library/eclipse.c b/bundles/org.eclipse.equinox.executable/library/eclipse.c
index 4495226b9..b2d9ba16b 100644
--- a/bundles/org.eclipse.equinox.executable/library/eclipse.c
+++ b/bundles/org.eclipse.equinox.executable/library/eclipse.c
@@ -1390,8 +1390,9 @@ static int processEEProps(_TCHAR* eeFile)
/* replace ${ee.home} with eeDir, loop in case there is more than one per argument */
while( (c1 = _tcsstr(argv[index], EE_HOME_VAR)) != NULL)
{
- c2 = malloc( (_tcslen(argv[index]) + _tcslen(eeDir) + _tcslen(c1) + 1) * sizeof(_TCHAR));
- *c1 = 0;
+ /* the space needed for c1 is included in _tcslen(argv[index]) */
+ c2 = malloc( (_tcslen(argv[index]) + _tcslen(eeDir) + 1) * sizeof(_TCHAR));
+ *c1 = _T_ECLIPSE('\0');
_stprintf(c2, _T_ECLIPSE("%s%s%s"), argv[index], eeDir, c1 + 10); /* ${ee.home} is 10 characters */
free(argv[index]);
argv[index] = c2;
@@ -1430,8 +1431,8 @@ static int processEEProps(_TCHAR* eeFile)
break;
}
}
- /* set ee.home and ee.filename variables */
- argv = realloc(argv, (nEEargs + 2) * sizeof(_TCHAR*));
+ /* set ee.home, ee.filename variables, and NULL */
+ argv = realloc(argv, (nEEargs + 3) * sizeof(_TCHAR*));
c1 = malloc( (_tcslen(EE_HOME) + _tcslen(eeDir) + 1) * sizeof(_TCHAR));
_stprintf(c1, _T_ECLIPSE("%s%s"), EE_HOME, eeDir);

Back to the top