snprintf() is not guaranteed to be safely callable from a signal
handler, so avoid calling it in the default non-verbose case.
---
 tests/test-async-sig.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tests/test-async-sig.c b/tests/test-async-sig.c
index ba37c90..9a0d39e 100644
--- a/tests/test-async-sig.c
+++ b/tests/test-async-sig.c
@@ -89,7 +89,8 @@ do_backtrace (int may_print, int get_proc_name)
       buf[0] = '\0';
       if (get_proc_name || (may_print && verbose))
        {
-         if (unw_get_proc_name (&cursor, name, sizeof (name), &off) == 0)
+         ret = unw_get_proc_name (&cursor, name, sizeof (name), &off);
+         if (ret == 0 && (may_print && verbose))
            {
              if (off)
                snprintf (buf, sizeof (buf), "<%s+0x%lx>", name, (long) off);
-- 
1.7.9.5


_______________________________________________
Libunwind-devel mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/libunwind-devel

Reply via email to