diff options
author | Alan Modra <amodra@gmail.com> | 2001-11-13 03:24:25 +0000 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2001-11-13 03:24:25 +0000 |
commit | e4afe7429548beac154bb41d8f553d614a222d17 (patch) | |
tree | 70be4b615c00d91a94c8a6433eb0517631f1805c | |
parent | 0cb2e7c50f6723f6ad9a492425a4826a963b36ba (diff) | |
download | binutils-gdb-e4afe7429548beac154bb41d8f553d614a222d17.tar.gz |
* config/obj-elf.c (obj_elf_version): Ensure terminating NUL is
put in note section. Use sizeof instead of hard-coded constants.
-rw-r--r-- | gas/ChangeLog | 7 | ||||
-rw-r--r-- | 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 <amodra@bigpond.net.au> + + * 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 <seufer@csv.ica.uni-stuttgart.de> * 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 <Stephane.Carrez@worldnet.fr> +2001-11-09 Stephane Carrez <Stephane.Carrez@worldnet.fr> * 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); |