# HG changeset patch # User dsamersoff # Date 1457373489 -10800 # Node ID 00416e804a661cd691bdeb70e7caebe40996560d # Parent a61a9898d62312796254d62c1e57f2d42d51eaf1 8147456: Parsing of argument for -agentpath can write outside of allocated memory Reviewed-by: sspitsyn, dholmes Contributed-by: sharath.ballal@oracle.com diff -r a61a9898d623 -r 00416e804a66 hotspot/src/os/posix/vm/os_posix.cpp --- a/hotspot/src/os/posix/vm/os_posix.cpp Mon Mar 07 10:01:38 2016 +0000 +++ b/hotspot/src/os/posix/vm/os_posix.cpp Mon Mar 07 20:58:09 2016 +0300 @@ -336,13 +336,13 @@ const char *start; if (lib_name != NULL) { - len = name_len = strlen(lib_name); + name_len = strlen(lib_name); if (is_absolute_path) { // Need to strip path, prefix and suffix if ((start = strrchr(lib_name, *os::file_separator())) != NULL) { lib_name = ++start; } - if (len <= (prefix_len + suffix_len)) { + if (strlen(lib_name) <= (prefix_len + suffix_len)) { return NULL; } lib_name += prefix_len;