8006103: [parfait] Possible null pointer dereference at hotspot/src/os/linux/vm/os_linux.cpp; os_windows.cpp; os_solaris.cpp; os_bsd.cpp
Reviewed-by: zgu, iklam
--- a/hotspot/src/os/bsd/vm/os_bsd.cpp Fri Mar 29 14:18:40 2013 -0700
+++ b/hotspot/src/os/bsd/vm/os_bsd.cpp Wed Apr 03 16:43:09 2013 -0700
@@ -1214,6 +1214,9 @@
} else if (strchr(pname, *os::path_separator()) != NULL) {
int n;
char** pelements = split_path(pname, &n);
+ if (pelements == NULL) {
+ return false;
+ }
for (int i = 0 ; i < n ; i++) {
// Really shouldn't be NULL, but check can't hurt
if (pelements[i] == NULL || strlen(pelements[i]) == 0) {
--- a/hotspot/src/os/linux/vm/os_linux.cpp Fri Mar 29 14:18:40 2013 -0700
+++ b/hotspot/src/os/linux/vm/os_linux.cpp Wed Apr 03 16:43:09 2013 -0700
@@ -1647,6 +1647,9 @@
} else if (strchr(pname, *os::path_separator()) != NULL) {
int n;
char** pelements = split_path(pname, &n);
+ if (pelements == NULL) {
+ return false;
+ }
for (int i = 0 ; i < n ; i++) {
// Really shouldn't be NULL, but check can't hurt
if (pelements[i] == NULL || strlen(pelements[i]) == 0) {
--- a/hotspot/src/os/solaris/vm/os_solaris.cpp Fri Mar 29 14:18:40 2013 -0700
+++ b/hotspot/src/os/solaris/vm/os_solaris.cpp Wed Apr 03 16:43:09 2013 -0700
@@ -1903,6 +1903,9 @@
} else if (strchr(pname, *os::path_separator()) != NULL) {
int n;
char** pelements = split_path(pname, &n);
+ if (pelements == NULL) {
+ return false;
+ }
for (int i = 0 ; i < n ; i++) {
// really shouldn't be NULL but what the heck, check can't hurt
if (pelements[i] == NULL || strlen(pelements[i]) == 0) {
--- a/hotspot/src/os/windows/vm/os_windows.cpp Fri Mar 29 14:18:40 2013 -0700
+++ b/hotspot/src/os/windows/vm/os_windows.cpp Wed Apr 03 16:43:09 2013 -0700
@@ -1177,6 +1177,9 @@
} else if (strchr(pname, *os::path_separator()) != NULL) {
int n;
char** pelements = split_path(pname, &n);
+ if (pelements == NULL) {
+ return false;
+ }
for (int i = 0 ; i < n ; i++) {
char* path = pelements[i];
// Really shouldn't be NULL, but check can't hurt