< prev index next >

src/os/aix/vm/os_aix.cpp

Print this page
rev 12741 : 8173848: realpath is unsafe
Summary: Fix occurrences of realpath in hotspot to use safe POSIX.1-2008 form.
Reviewed-by: dsamersoff, dholmes, clanger

*** 1574,1584 **** } Dl_info dlinfo; int ret = dladdr(CAST_FROM_FN_PTR(void *, os::jvm_path), &dlinfo); assert(ret != 0, "cannot locate libjvm"); ! char* rp = realpath((char *)dlinfo.dli_fname, buf); assert(rp != NULL, "error in realpath(): maybe the 'path' argument is too long?"); strncpy(saved_jvm_path, buf, sizeof(saved_jvm_path)); saved_jvm_path[sizeof(saved_jvm_path) - 1] = '\0'; } --- 1574,1584 ---- } Dl_info dlinfo; int ret = dladdr(CAST_FROM_FN_PTR(void *, os::jvm_path), &dlinfo); assert(ret != 0, "cannot locate libjvm"); ! char* rp = os::Posix::realpath((char *)dlinfo.dli_fname, buf, buflen); assert(rp != NULL, "error in realpath(): maybe the 'path' argument is too long?"); strncpy(saved_jvm_path, buf, sizeof(saved_jvm_path)); saved_jvm_path[sizeof(saved_jvm_path) - 1] = '\0'; }
< prev index next >