about summary refs log tree commit diff
path: root/elf/dl-open.c
diff options
context:
space:
mode:
authorSiddhesh Poyarekar <siddhesh@redhat.com>2013-05-29 21:30:20 +0530
committerSiddhesh Poyarekar <siddhesh@redhat.com>2013-05-29 21:34:12 +0530
commitb937534868c8d7aec3b6d645bf5fd657bbfccd42 (patch)
tree18936faaea13f35bcaf698f97447752c0e1c4567 /elf/dl-open.c
parentd0501bfbe228897c17875fcead8809d017135d6f (diff)
downloadglibc-b937534868c8d7aec3b6d645bf5fd657bbfccd42.tar.gz
glibc-b937534868c8d7aec3b6d645bf5fd657bbfccd42.tar.xz
glibc-b937534868c8d7aec3b6d645bf5fd657bbfccd42.zip
Avoid crashing in LD_DEBUG when program name is unavailable
Resolves: #15465

The program name may be unavailable if the user application tampers
with argc and argv[].  Some parts of the dynamic linker caters for
this while others don't, so this patch consolidates the check and
fallback into a single macro and updates all users.
Diffstat (limited to 'elf/dl-open.c')
-rw-r--r--elf/dl-open.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/elf/dl-open.c b/elf/dl-open.c
index 92fae7f59b..0f054bfca2 100644
--- a/elf/dl-open.c
+++ b/elf/dl-open.c
@@ -733,7 +733,7 @@ void
 _dl_show_scope (struct link_map *l, int from)
 {
   _dl_debug_printf ("object=%s [%lu]\n",
-		    *l->l_name ? l->l_name : rtld_progname, l->l_ns);
+		    DSO_FILENAME (l->l_name), l->l_ns);
   if (l->l_scope != NULL)
     for (int scope_cnt = from; l->l_scope[scope_cnt] != NULL; ++scope_cnt)
       {
@@ -744,7 +744,7 @@ _dl_show_scope (struct link_map *l, int from)
 	    _dl_debug_printf_c (" %s",
 				l->l_scope[scope_cnt]->r_list[cnt]->l_name);
 	  else
-	    _dl_debug_printf_c (" %s", rtld_progname);
+	    _dl_debug_printf_c (" %s", RTLD_PROGNAME);
 
 	_dl_debug_printf_c ("\n");
       }