-
Bug
-
Resolution: Duplicate
-
P3
-
None
-
1.1.3, 1.1.4, 1.1.5
-
generic, sparc
-
solaris_2.5.1, solaris_2.6
Function SetLibraryPath in module src/solaris/java/jre/jre_md.c (JDK 113)
retrieves the value of The logic in the function
is backwards with respect to updating the value to include additional
values. If LD_LIBRARY_PATH. is not set, the function attempts to do
a strlen() and tries to append to it. If it is set, it basically
overwrites it.
/*
* Sets LD_LIBRARY_PATH to include the specified directory.
*/
void
SetLibraryPath(const char *dir)
{
char *s = getenv("LD_LIBRARY_PATH"), *buf;
/* Set library path */
if (s == 0) {
buf = JRE_Malloc(strlen(dir) + strlen(s) + 32);
sprintf(buf, "LD_LIBRARY_PATH=%s:%s", dir, s);
} else {
buf = JRE_Malloc(strlen(dir) + 32);
sprintf(buf, "LD_LIBRARY_PATH=%s", dir);
}
if (putenv(buf) != 0) {
perror("putenv");
exit(1);
}
}
retrieves the value of The logic in the function
is backwards with respect to updating the value to include additional
values. If LD_LIBRARY_PATH. is not set, the function attempts to do
a strlen() and tries to append to it. If it is set, it basically
overwrites it.
/*
* Sets LD_LIBRARY_PATH to include the specified directory.
*/
void
SetLibraryPath(const char *dir)
{
char *s = getenv("LD_LIBRARY_PATH"), *buf;
/* Set library path */
if (s == 0) {
buf = JRE_Malloc(strlen(dir) + strlen(s) + 32);
sprintf(buf, "LD_LIBRARY_PATH=%s:%s", dir, s);
} else {
buf = JRE_Malloc(strlen(dir) + 32);
sprintf(buf, "LD_LIBRARY_PATH=%s", dir);
}
if (putenv(buf) != 0) {
perror("putenv");
exit(1);
}
}
- duplicates
-
JDK-4081696 jre bug -- SetLibraryPath() derefs nil pointer
- Closed
-
JDK-4096955 jre doesn't allow you to specify library paths
- Closed