summaryrefslogtreecommitdiffstats
path: root/libdwfl/linux-core-attach.c
diff options
context:
space:
mode:
Diffstat (limited to 'libdwfl/linux-core-attach.c')
-rw-r--r--libdwfl/linux-core-attach.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/libdwfl/linux-core-attach.c b/libdwfl/linux-core-attach.c
index 93d0e46e..f82ed032 100644
--- a/libdwfl/linux-core-attach.c
+++ b/libdwfl/linux-core-attach.c
@@ -125,7 +125,8 @@ core_next_thread (Dwfl *dwfl __attribute__ ((unused)), void *dwfl_arg,
&desc_offset)) > 0)
{
/* Do not check NAME for now, help broken Linux kernels. */
- const char *name = note_data->d_buf + name_offset;
+ const char *name = (nhdr.n_namesz == 0
+ ? "" : note_data->d_buf + name_offset);
const char *desc = note_data->d_buf + desc_offset;
GElf_Word regs_offset;
size_t nregloc;
@@ -178,7 +179,8 @@ core_set_initial_registers (Dwfl_Thread *thread, void *thread_arg_voidp)
/* __libdwfl_attach_state_for_core already verified the note is there. */
assert (getnote_err != 0);
/* Do not check NAME for now, help broken Linux kernels. */
- const char *name = note_data->d_buf + name_offset;
+ const char *name = (nhdr.n_namesz == 0
+ ? "" : note_data->d_buf + name_offset);
const char *desc = note_data->d_buf + desc_offset;
GElf_Word regs_offset;
size_t nregloc;
@@ -367,7 +369,8 @@ dwfl_core_file_attach (Dwfl *dwfl, Elf *core)
&nhdr, &name_offset, &desc_offset)) > 0)
{
/* Do not check NAME for now, help broken Linux kernels. */
- const char *name = note_data->d_buf + name_offset;
+ const char *name = (nhdr.n_namesz == 0
+ ? "" : note_data->d_buf + name_offset);
const char *desc = note_data->d_buf + desc_offset;
GElf_Word regs_offset;
size_t nregloc;