Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/external/gpl3/binutils/dist/binutils use asprintf(3)
details: https://anonhg.NetBSD.org/src/rev/534d112f3312
branches: trunk
changeset: 341217:534d112f3312
user: christos <christos%NetBSD.org@localhost>
date: Mon Oct 26 15:14:33 2015 +0000
description:
use asprintf(3)
diffstat:
external/gpl3/binutils/dist/binutils/arsup.c | 11 +++++++++--
1 files changed, 9 insertions(+), 2 deletions(-)
diffs (26 lines):
diff -r a4838772f0cb -r 534d112f3312 external/gpl3/binutils/dist/binutils/arsup.c
--- a/external/gpl3/binutils/dist/binutils/arsup.c Mon Oct 26 15:07:07 2015 +0000
+++ b/external/gpl3/binutils/dist/binutils/arsup.c Mon Oct 26 15:14:33 2015 +0000
@@ -149,13 +149,20 @@
void
ar_open (char *name, int t)
{
- char *tname = (char *) xmalloc (strlen (name) + 10);
+ char *tname;
const char *bname = lbasename (name);
real_name = name;
/* Prepend tmp- to the beginning, to avoid file-name clashes after
truncation on filesystems with limited namespaces (DOS). */
- sprintf (tname, "%.*stmp-%s", (int) (bname - name), name, bname);
+ if (asprintf (&tname, "%.*stmp-%s", (int) (bname - name), name, bname) == -1)
+ {
+ fprintf (stderr, _("%s: Can't allocate memory for temp name (%s)\n"),
+ program_name, strerror(errno));
+ maybequit ();
+ return;
+ }
+
obfd = bfd_openw (tname, NULL);
if (!obfd)
Home |
Main Index |
Thread Index |
Old Index