+2017-03-24 Mark Wielaard <mark@klomp.org>
+
+ * linux-core-attach.c (core_next_thread): If n_namesz == 0 then
+ the note name data is the empty string.
+ (dwfl_core_file_attach): Likewise.
+
2017-02-15 Ulf Hermann <ulf.hermann@qt.io>
* linux-kernel-modules.c: Include system.h.
&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;
/* __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;
&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;
+2017-03-24 Mark Wielaard <mjw@redhat.com>
+
+ * elfcmp.c (main): If n_namesz == 0 then the note name data is the
+ empty string.
+ * readelf.c (handle_notes_data): Likewise.
+
2017-03-24 Mark Wielaard <mjw@redhat.com>
* readelf.c (handle_gnu_hash): Check inner < max_nsyms before
&& (off1 = gelf_getnote (data1, off1, ¬e1,
&name_offset, &desc_offset)) > 0)
{
- const char *name1 = data1->d_buf + name_offset;
+ const char *name1 = (note1.n_namesz == 0
+ ? "" : data1->d_buf + name_offset);
const void *desc1 = data1->d_buf + desc_offset;
if (off2 >= data2->d_size)
{
error (2, 0, gettext ("\
cannot read note section [%zu] '%s' in '%s': %s"),
elf_ndxscn (scn2), sname2, fname2, elf_errmsg (-1));
- const char *name2 = data2->d_buf + name_offset;
+ const char *name2 = (note2.n_namesz == 0
+ ? "" : data2->d_buf + name_offset);
const void *desc2 = data2->d_buf + desc_offset;
if (note1.n_namesz != note2.n_namesz
&& (offset = gelf_getnote (data, offset,
&nhdr, &name_offset, &desc_offset)) > 0)
{
- const char *name = data->d_buf + name_offset;
+ const char *name = nhdr.n_namesz == 0 ? "" : data->d_buf + name_offset;
const char *desc = data->d_buf + desc_offset;
char buf[100];