From 24402beb7ef4dde44ce7604078f8f0c4511cf2d9 Mon Sep 17 00:00:00 2001 From: ccheung Date: Wed, 3 Apr 2013 16:43:09 -0700 Subject: [PATCH] 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 --- src/os/bsd/vm/os_bsd.cpp | 3 +++ src/os/linux/vm/os_linux.cpp | 3 +++ src/os/solaris/vm/os_solaris.cpp | 3 +++ src/os/windows/vm/os_windows.cpp | 3 +++ 4 files changed, 12 insertions(+) diff --git a/src/os/bsd/vm/os_bsd.cpp b/src/os/bsd/vm/os_bsd.cpp index a09db3728..44bec82c0 100644 --- a/src/os/bsd/vm/os_bsd.cpp +++ b/src/os/bsd/vm/os_bsd.cpp @@ -1214,6 +1214,9 @@ bool os::dll_build_name(char* buffer, size_t buflen, } 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) { diff --git a/src/os/linux/vm/os_linux.cpp b/src/os/linux/vm/os_linux.cpp index 29842b223..efaefc484 100644 --- a/src/os/linux/vm/os_linux.cpp +++ b/src/os/linux/vm/os_linux.cpp @@ -1647,6 +1647,9 @@ bool os::dll_build_name(char* buffer, size_t buflen, } 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) { diff --git a/src/os/solaris/vm/os_solaris.cpp b/src/os/solaris/vm/os_solaris.cpp index bdd78ad02..58601690c 100644 --- a/src/os/solaris/vm/os_solaris.cpp +++ b/src/os/solaris/vm/os_solaris.cpp @@ -1903,6 +1903,9 @@ bool os::dll_build_name(char* buffer, size_t buflen, } 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) { diff --git a/src/os/windows/vm/os_windows.cpp b/src/os/windows/vm/os_windows.cpp index 4a99a1b39..a512c59d2 100644 --- a/src/os/windows/vm/os_windows.cpp +++ b/src/os/windows/vm/os_windows.cpp @@ -1177,6 +1177,9 @@ bool os::dll_build_name(char *buffer, size_t buflen, } 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 -- GitLab