Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLeo Ufimtsev2018-01-19 14:27:38 -0500
committerAlexander Kurtakov2018-01-23 00:26:12 -0500
commit6ac11ebbb77fe77f89880d2f075daf2ac0c81d4b (patch)
tree99acb7a34109d4a991812c1486f532c22a7a9e9b /features
parent0ee18f4293e79413c1c4dc4418a16f867ae570ca (diff)
downloadrt.equinox.framework-6ac11ebbb77fe77f89880d2f075daf2ac0c81d4b.tar.gz
rt.equinox.framework-6ac11ebbb77fe77f89880d2f075daf2ac0c81d4b.tar.xz
rt.equinox.framework-6ac11ebbb77fe77f89880d2f075daf2ac0c81d4b.zip
Bug 529695 --launcher.openFile with relative path crashes
Crash is caused due to a null pointer. program (path) is a global var. It's being read by strlen before it's set. eclispe.c:417:run() -> parseArgs() -> next = checkPath(next, getProgramDir(), 0); checkPath() : paths[1] = .. programDir; buffer = malloc(.. _tcslen(paths[1])...) << strlen on a null. But it's only set later: eclispe.c:417:run() -> parseArgs() << used here. -> _run() { -> program = _tcsdup( argv[0] ); << set here. } Solution is fairly trivial, just set "program" before it's used. Verified on Linux Fedora 27. I don't see it causing issues on other platforms, it's a very minor fix. Should probably be good to merge. Bug: https://bugs.eclipse.org/bugs/show_bug.cgi?id=529695 Change-Id: I379970ecce553ef4f78a246a96ee9ac647471739 Signed-off-by: Leo Ufimtsev <lufimtse@redhat.com>
Diffstat (limited to 'features')
-rw-r--r--features/org.eclipse.equinox.executable.feature/library/eclipse.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/features/org.eclipse.equinox.executable.feature/library/eclipse.c b/features/org.eclipse.equinox.executable.feature/library/eclipse.c
index 9ab57f740..d848d03be 100644
--- a/features/org.eclipse.equinox.executable.feature/library/eclipse.c
+++ b/features/org.eclipse.equinox.executable.feature/library/eclipse.c
@@ -416,6 +416,9 @@ static void dummyCallback(void * info) {}
/* vmArgs must be NULL terminated */
JNIEXPORT int run(int argc, _TCHAR* argv[], _TCHAR* vmArgs[])
{
+ /* arg[0] should be the full pathname of this program. */
+ program = _tcsdup( argv[0] );
+
/* Parse command line arguments (looking for the VM to use). */
/* Override configuration file arguments */
parseArgs( &argc, argv );
@@ -500,9 +503,6 @@ static int _run(int argc, _TCHAR* argv[], _TCHAR* vmArgs[])
int launchMode;
int running = 1;
- /* arg[0] should be the full pathname of this program. */
- program = _tcsdup( argv[0] );
-
/* Initialize official program name */
officialName = name != NULL ? _tcsdup( name ) : getDefaultOfficialName();

Back to the top