diff options
author | Ian Lance Taylor <ian@airs.com> | 1994-03-31 19:05:03 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@airs.com> | 1994-03-31 19:05:03 +0000 |
commit | 3af0f479d04c4c57bddd81ab139603061018cb00 (patch) | |
tree | 97c41427bba22b9fb719c4275bc3aadf6cdcafcb /bfd/nlm32-sparc.c | |
parent | e770a5941381a21a0c07d5b79d73f4570ab4b964 (diff) | |
download | gdb-3af0f479d04c4c57bddd81ab139603061018cb00.zip gdb-3af0f479d04c4c57bddd81ab139603061018cb00.tar.gz gdb-3af0f479d04c4c57bddd81ab139603061018cb00.tar.bz2 |
* nlm32-i386.c (nlm_i386_read_import): Null terminate the symbol
name.
* nlm32-alpha.c (nlm_alpha_read_import): Likewise.
* nlm32-sparc.c (nlm_sparc_read_import): Likewise.
Diffstat (limited to 'bfd/nlm32-sparc.c')
-rw-r--r-- | bfd/nlm32-sparc.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/bfd/nlm32-sparc.c b/bfd/nlm32-sparc.c index 8c97cc5..5626a86 100644 --- a/bfd/nlm32-sparc.c +++ b/bfd/nlm32-sparc.c @@ -253,6 +253,7 @@ nlm_sparc_read_import (abfd, sym) bfd_size_type rcount; /* number of relocs */ bfd_byte temp[NLM_TARGET_LONG_SIZE]; /* temporary 32-bit value */ unsigned char symlength; /* length of symbol name */ + char *name; /* * First, read in the number of relocation @@ -271,8 +272,8 @@ nlm_sparc_read_import (abfd, sym) != sizeof (symlength)) return false; sym -> symbol.the_bfd = abfd; - sym -> symbol.name = bfd_alloc (abfd, symlength + 1); - if (!sym -> symbol.name) + name = bfd_alloc (abfd, symlength + 1); + if (name == NULL) { bfd_set_error (bfd_error_no_memory); return false; @@ -282,9 +283,10 @@ nlm_sparc_read_import (abfd, sym) * Then read in the symbol */ - if (bfd_read ((PTR) sym -> symbol.name, symlength, 1, abfd) - != symlength) + if (bfd_read (name, symlength, 1, abfd) != symlength) return false; + name[symlength] = '\0'; + sym -> symbol.name = name; sym -> symbol.flags = 0; sym -> symbol.value = 0; sym -> symbol.section = &bfd_und_section; |