changeset 4453:17bf4d428955

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
author ccheung
date Wed, 03 Apr 2013 16:43:09 -0700
parents bad3bed4b323
children cc32ccaaf47f
files src/os/bsd/vm/os_bsd.cpp src/os/linux/vm/os_linux.cpp src/os/solaris/vm/os_solaris.cpp src/os/windows/vm/os_windows.cpp
diffstat 4 files changed, 12 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/os/bsd/vm/os_bsd.cpp	Fri Mar 29 14:18:40 2013 -0700
+++ b/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/src/os/linux/vm/os_linux.cpp	Fri Mar 29 14:18:40 2013 -0700
+++ b/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/src/os/solaris/vm/os_solaris.cpp	Fri Mar 29 14:18:40 2013 -0700
+++ b/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/src/os/windows/vm/os_windows.cpp	Fri Mar 29 14:18:40 2013 -0700
+++ b/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