char *oname;
bfd *abfd;
- oname = xmalloc (20 + dll_symname_len);
- sprintf (oname, "%s_d%06d.o", dll_symname, tmp_seq);
+ if (asprintf (&oname, "%s_d%06d.o", dll_symname, tmp_seq) < 4)
+ /* In theory we should return NULL here at let our caller decide what to
+ do. But currently the return value is not checked, just used, and
+ besides, this condition only happens when the system has run out of
+ memory. So just give up. */
+ exit (EXIT_FAILURE);
tmp_seq++;
abfd = bfd_create (oname, parent);
char *oname;
bfd *abfd;
- oname = xmalloc (20 + dll_symname_len);
- sprintf (oname, "%s_d%06d.o", dll_symname, tmp_seq);
+ if (asprintf (&oname, "%s_d%06d.o", dll_symname, tmp_seq) < 4)
+ /* In theory we should return NULL here at let our caller decide what to
+ do. But currently the return value is not checked, just used, and
+ besides, this condition only happens when the system has run out of
+ memory. So just give up. */
+ exit (EXIT_FAILURE);
tmp_seq++;
abfd = bfd_create (oname, parent);
}
}
- oname = xmalloc (20 + dll_symname_len);
- sprintf (oname, "%s_d%06d.o", dll_symname, tmp_seq);
+ if (asprintf (&oname, "%s_d%06d.o", dll_symname, tmp_seq) < 4)
+ /* In theory we should return NULL here at let our caller decide what to
+ do. But currently the return value is not checked, just used, and
+ besides, this condition only happens when the system has run out of
+ memory. So just give up. */
+ exit (EXIT_FAILURE);
tmp_seq++;
abfd = bfd_create (oname, parent);
char *oname;
bfd *abfd;
- oname = xmalloc (20 + dll_symname_len);
- sprintf (oname, "%s_nmth%06d.o", dll_symname, tmp_seq);
+ if (asprintf (&oname, "%s_nmth%06d.o", dll_symname, tmp_seq) < 4)
+ /* In theory we should return NULL here at let our caller decide what to
+ do. But currently the return value is not checked, just used, and
+ besides, this condition only happens when the system has run out of
+ memory. So just give up. */
+ exit (EXIT_FAILURE);
tmp_seq++;
abfd = bfd_create (oname, parent);
struct bfd_symbol *sym = *rel->sym_ptr_ptr;
bfd *abfd = bfd_asymbol_bfd (sym);
struct bfd_link_hash_entry *bh;
- char *fixup_name, buf[26];
+ char *fixup_name, buf[256];
size_t prefix_len;
/* "name" buffer has space before the symbol name for prefixes. */
char *oname;
bfd *abfd;
- oname = xmalloc (20 + dll_symname_len);
- sprintf (oname, "%s_fu%06d.o", dll_symname, tmp_seq);
+ if (asprintf (&oname, "%s_fu%06d.o", dll_symname, tmp_seq) < 4)
+ /* In theory we should return NULL here at let our caller decide what to
+ do. But currently the return value is not checked, just used, and
+ besides, this condition only happens when the system has run out of
+ memory. So just give up. */
+ exit (EXIT_FAILURE);
tmp_seq++;
abfd = bfd_create (oname, parent);
bfd *abfd;
bfd_size_type size;
- oname = xmalloc (20 + dll_symname_len);
- sprintf (oname, "%s_rtr%06d.o", dll_symname, tmp_seq);
+ if (asprintf (&oname, "%s_rtr%06d.o", dll_symname, tmp_seq) < 4)
+ /* In theory we should return NULL here at let our caller decide what to
+ do. But currently the return value is not checked, just used, and
+ besides, this condition only happens when the system has run out of
+ memory. So just give up. */
+ exit (EXIT_FAILURE);
tmp_seq++;
abfd = bfd_create (oname, parent);
char *oname;
bfd *abfd;
- oname = xmalloc (20 + dll_symname_len);
- sprintf (oname, "%s_ertr%06d.o", dll_symname, tmp_seq);
+ if (asprintf (&oname, "%s_ertr%06d.o", dll_symname, tmp_seq) < 4)
+ /* In theory we should return NULL here at let our caller decide what to
+ do. But currently the return value is not checked, just used, and
+ besides, this condition only happens when the system has run out of
+ memory. So just give up. */
+ exit (EXIT_FAILURE);
tmp_seq++;
abfd = bfd_create (oname, parent);