{
if (dl_info.dli_fname)
strncpy (file_name, dl_info.dli_fname, sizeof file_name);
- strncpy (method_name, dl_info.dli_sname, sizeof method_name);
+ if (dl_info.dli_sname)
+ strncpy (method_name, dl_info.dli_sname, sizeof method_name);
/* Don't trust dladdr() if the address is from the main program. */
if (dl_info.dli_fname != NULL
+ && dl_info.dli_sname != NULL
&& (_Jv_argv == NULL || strcmp (file_name, _Jv_argv[0]) != 0))
return true;
}