diff options
author | Siddhesh Poyarekar <siddhesh@redhat.com> | 2013-05-29 21:30:20 +0530 |
---|---|---|
committer | Siddhesh Poyarekar <siddhesh@redhat.com> | 2013-05-29 21:34:12 +0530 |
commit | b937534868c8d7aec3b6d645bf5fd657bbfccd42 (patch) | |
tree | 18936faaea13f35bcaf698f97447752c0e1c4567 /elf/dl-version.c | |
parent | d0501bfbe228897c17875fcead8809d017135d6f (diff) | |
download | glibc-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-version.c')
-rw-r--r-- | elf/dl-version.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/elf/dl-version.c b/elf/dl-version.c index c02baa0..62be4ae 100644 --- a/elf/dl-version.c +++ b/elf/dl-version.c @@ -85,7 +85,7 @@ match_symbol (const char *name, Lmid_t ns, ElfW(Word) hash, const char *string, if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_VERSIONS, 0)) _dl_debug_printf ("\ checking for version `%s' in file %s [%lu] required by file %s [%lu]\n", - string, map->l_name[0] ? map->l_name : rtld_progname, + string, DSO_FILENAME (map->l_name), map->l_ns, name, ns); if (__builtin_expect (map->l_info[VERSYMIDX (DT_VERDEF)] == NULL, 0)) @@ -162,7 +162,7 @@ no version information available (required by ", name, ")"); name, ")"); result = 1; call_cerror: - _dl_signal_cerror (0, map->l_name[0] ? map->l_name : rtld_progname, + _dl_signal_cerror (0, DSO_FILENAME (map->l_name), N_("version lookup error"), errstring); return result; } @@ -210,7 +210,7 @@ _dl_check_map_versions (struct link_map *map, int verbose, int trace_mode) &buf[sizeof (buf) - 1], 10, 0), " of Verneed record\n"); call_error: - _dl_signal_error (errval, *map->l_name ? map->l_name : rtld_progname, + _dl_signal_error (errval, DSO_FILENAME (map->l_name), NULL, errstring); } @@ -234,8 +234,7 @@ _dl_check_map_versions (struct link_map *map, int verbose, int trace_mode) while (1) { /* Match the symbol. */ - result |= match_symbol ((*map->l_name - ? map->l_name : rtld_progname), + result |= match_symbol (DSO_FILENAME (map->l_name), map->l_ns, aux->vna_hash, strtab + aux->vna_name, needed->l_real, verbose, |