8006103: [parfait] Possible null pointer dereference at hotspot/src/os/linux/vm/os_linux.cpp; os_windows.cpp; os_solaris.cpp; os_bsd.cpp
authorccheung
Wed, 03 Apr 2013 16:43:09 -0700
changeset 16669 fb3397cee116
parent 16668 18d44c04282d
child 16670 4af09aff4237
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
hotspot/src/os/bsd/vm/os_bsd.cpp
hotspot/src/os/linux/vm/os_linux.cpp
hotspot/src/os/solaris/vm/os_solaris.cpp
hotspot/src/os/windows/vm/os_windows.cpp
--- 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