From e4afe7429548beac154bb41d8f553d614a222d17 Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Tue, 13 Nov 2001 03:24:25 +0000 Subject: [PATCH] * config/obj-elf.c (obj_elf_version): Ensure terminating NUL is put in note section. Use sizeof instead of hard-coded constants. --- gas/ChangeLog | 7 ++++++- gas/config/obj-elf.c | 18 ++++++------------ 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/gas/ChangeLog b/gas/ChangeLog index d8d8908aac2..fe13be36c37 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,8 @@ +2001-11-13 Alan Modra + + * config/obj-elf.c (obj_elf_version): Ensure terminating NUL is + put in note section. Use sizeof instead of hard-coded constants. + 2001-11-12 Thiemo Seufer * config/tc-mips.c (support_64bit_objects): Define for OBJ_ELF only. @@ -50,7 +55,7 @@ * config/tc-avr.c (mcu_types): Update for new devices. -2001-11-02 Stephane Carrez +2001-11-09 Stephane Carrez * doc/Makefile.am (POD2MAN): Use 'GNU Development Tools' for the page man title. diff --git a/gas/config/obj-elf.c b/gas/config/obj-elf.c index 7b6c5b2f637..3c4531e77ca 100644 --- a/gas/config/obj-elf.c +++ b/gas/config/obj-elf.c @@ -1417,14 +1417,13 @@ obj_elf_version (ignore) { char *name; unsigned int c; - char ch; char *p; asection *seg = now_seg; subsegT subseg = now_subseg; Elf_Internal_Note i_note; Elf_External_Note e_note; asection *note_secp = (asection *) NULL; - int i, len; + int len; SKIP_WHITESPACE (); if (*input_line_pointer == '\"') @@ -1454,19 +1453,14 @@ obj_elf_version (ignore) i_note.descsz = 0; /* no description */ i_note.type = NT_VERSION; p = frag_more (sizeof (e_note.namesz)); - md_number_to_chars (p, (valueT) i_note.namesz, 4); + md_number_to_chars (p, (valueT) i_note.namesz, sizeof (e_note.namesz)); p = frag_more (sizeof (e_note.descsz)); - md_number_to_chars (p, (valueT) i_note.descsz, 4); + md_number_to_chars (p, (valueT) i_note.descsz, sizeof (e_note.descsz)); p = frag_more (sizeof (e_note.type)); - md_number_to_chars (p, (valueT) i_note.type, 4); + md_number_to_chars (p, (valueT) i_note.type, sizeof (e_note.type)); + p = frag_more (len + 1); + strcpy (p, name); - for (i = 0; i < len; i++) - { - ch = *(name + i); - { - FRAG_APPEND_1_CHAR (ch); - } - } frag_align (2, 0, 0); subseg_set (seg, subseg); -- 2.30.2