about summary refs log tree commit diff
path: root/elf/dl-load.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-load.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-load.c')
-rw-r--r--elf/dl-load.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/elf/dl-load.c b/elf/dl-load.c
index dd182c9155..757b6ec56b 100644
--- a/elf/dl-load.c
+++ b/elf/dl-load.c
@@ -1651,7 +1651,7 @@ print_search_path (struct r_search_path_elem **list,
 
   if (name != NULL)
     _dl_debug_printf_c ("\t\t(%s from file %s)\n", what,
-			name[0] ? name : rtld_progname);
+			DSO_FILENAME (name));
   else
     _dl_debug_printf_c ("\t\t(%s)\n", what);
 }
@@ -2124,8 +2124,7 @@ _dl_map_object (struct link_map *loader, const char *name,
     _dl_debug_printf ((mode & __RTLD_CALLMAP) == 0
 		      ? "\nfile=%s [%lu];  needed by %s [%lu]\n"
 		      : "\nfile=%s [%lu];  dynamically loaded by %s [%lu]\n",
-		      name, nsid, loader->l_name[0]
-		      ? loader->l_name : rtld_progname, loader->l_ns);
+		      name, nsid, DSO_FILENAME (loader->l_name), loader->l_ns);
 
 #ifdef SHARED
   /* Give the auditing libraries a chance to change the name before we