1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

addr2line.c (main_exe_path): avoid SEGV when /proc is not available

readlink would return -1 if /proc is not mounted.
Coverity Scan found this issue.
This commit is contained in:
Yusuke Endoh 2019-07-14 17:53:45 +09:00
parent 47e571c951
commit db1c30b37f

View file

@ -2050,6 +2050,7 @@ main_exe_path(void)
{
# define PROC_SELF_EXE "/proc/self/exe"
ssize_t len = readlink(PROC_SELF_EXE, binary_filename, PATH_MAX);
if (len < 0) return 0;
binary_filename[len] = 0;
return len;
}