From 5d55d61c17f53f0f2ad1080e0548db8b10b8b026 Mon Sep 17 00:00:00 2001 From: Joel Dice Date: Wed, 31 Aug 2011 21:16:22 -0600 Subject: [PATCH] fix use of uninitalized memory in jnienv.cpp --- src/jnienv.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/jnienv.cpp b/src/jnienv.cpp index a18e8433c0..4d4518febd 100644 --- a/src/jnienv.cpp +++ b/src/jnienv.cpp @@ -3324,11 +3324,15 @@ JNI_CreateJavaVM(Machine** m, Thread** t, void* args) unsigned bootClasspathBufferSize = bcppl + bcpl + bcpal + 3; RUNTIME_ARRAY(char, bootClasspathBuffer, bootClasspathBufferSize); char* bootClasspathPointer = RUNTIME_ARRAY_BODY(bootClasspathBuffer); - local::append(&bootClasspathPointer, bootClasspathPrepend, bcppl, - bcpl + bcpal ? PATH_SEPARATOR : 0); - local::append(&bootClasspathPointer, bootClasspath, bcpl, - bcpal ? PATH_SEPARATOR : 0); - local::append(&bootClasspathPointer, bootClasspathAppend, bcpal, 0); + if (bootClasspathBufferSize > 3) { + local::append(&bootClasspathPointer, bootClasspathPrepend, bcppl, + bcpl + bcpal ? PATH_SEPARATOR : 0); + local::append(&bootClasspathPointer, bootClasspath, bcpl, + bcpal ? PATH_SEPARATOR : 0); + local::append(&bootClasspathPointer, bootClasspathAppend, bcpal, 0); + } else { + *RUNTIME_ARRAY_BODY(bootClasspathBuffer) = 0; + } Finder* bf = makeFinder (s, h, RUNTIME_ARRAY_BODY(bootClasspathBuffer), bootLibrary);