This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Suggest a fix?
- From: msnyder at sonic dot net
- To: binutils at sourceware dot org
- Date: Fri, 27 Jul 2007 15:35:56 -0700 (PDT)
- Subject: Suggest a fix?
I see two instances of this code fragment in elflink.c:
name = h->root.root.string;
p = strchr (name, ELF_VER_CHR);
if (p != NULL)
{
alc = bfd_malloc (p - name + 1);
memcpy (alc, name, p - name);
alc[p - name] = '\0';
name = alc;
}
One is in elf_collect_hash_codes, and one in elf_collect_gnu_hash_codes.
The issue is that the bfd_malloc is not checked for null return, and I'm
not sure what best to do if it returns null.
By any chance, is there an upper limit to the length of 'name',
and could we just use a static or local buffer? I know you guys
don't like to use alloca...