aboutsummaryrefslogtreecommitdiff
path: root/elf/dl-init.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-init.c
parentd0501bfbe228897c17875fcead8809d017135d6f (diff)
downloadglibc-b937534868c8d7aec3b6d645bf5fd657bbfccd42.zip
glibc-b937534868c8d7aec3b6d645bf5fd657bbfccd42.tar.gz
glibc-b937534868c8d7aec3b6d645bf5fd657bbfccd42.tar.bz2
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-init.c')
-rw-r--r--elf/dl-init.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/elf/dl-init.c b/elf/dl-init.c
index fe4d2a0..a657eb6 100644
--- a/elf/dl-init.c
+++ b/elf/dl-init.c
@@ -54,7 +54,7 @@ call_init (struct link_map *l, int argc, char **argv, char **env)
/* Print a debug message if wanted. */
if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_IMPCALLS, 0))
_dl_debug_printf ("\ncalling init: %s\n\n",
- l->l_name[0] ? l->l_name : rtld_progname);
+ DSO_FILENAME (l->l_name));
/* Now run the local constructors. There are two forms of them:
- the one named by DT_INIT
@@ -110,8 +110,7 @@ _dl_init (struct link_map *main_map, int argc, char **argv, char **env)
if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_IMPCALLS, 0))
_dl_debug_printf ("\ncalling preinit: %s\n\n",
- main_map->l_name[0]
- ? main_map->l_name : rtld_progname);
+ DSO_FILENAME (main_map->l_name));
addrs = (ElfW(Addr) *) (preinit_array->d_un.d_ptr + main_map->l_addr);
for (cnt = 0; cnt < i; ++cnt)