summaryrefslogtreecommitdiff
path: root/gnu/lib/libiberty
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2010-05-26 11:23:08 +0000
committerMarc Espie <espie@cvs.openbsd.org>2010-05-26 11:23:08 +0000
commitdd1019fe6097646764d06cab8fcd7aa9aed4abbf (patch)
treeb319dd35476412f2a15eab80c5ada171acaaa5d1 /gnu/lib/libiberty
parentd9807ca719bb5ff5661995719eaf1e513437c3c0 (diff)
make gcc4 lib sprintf/strcpy free.
activate proper C99 stuff. fix locale support when there's no locale. work common with kettenis@
Diffstat (limited to 'gnu/lib/libiberty')
-rw-r--r--gnu/lib/libiberty/src/cp-demangle.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/gnu/lib/libiberty/src/cp-demangle.c b/gnu/lib/libiberty/src/cp-demangle.c
index b5bfd953769..d5771b51ee2 100644
--- a/gnu/lib/libiberty/src/cp-demangle.c
+++ b/gnu/lib/libiberty/src/cp-demangle.c
@@ -3797,17 +3797,18 @@ d_demangle (const char* mangled, int options, size_t *palc)
&& mangled[10] == '_')
{
char *r;
+ size_t sz = 40 + len - 11;
- r = (char *) malloc (40 + len - 11);
+ r = (char *) malloc (sz);
if (r == NULL)
*palc = 1;
else
{
if (mangled[9] == 'I')
- strcpy (r, "global constructors keyed to ");
+ strlcpy (r, "global constructors keyed to ", sz);
else
- strcpy (r, "global destructors keyed to ");
- strcat (r, mangled + 11);
+ strlcpy (r, "global destructors keyed to ", sz);
+ strlcat (r, mangled + 11, sz);
}
return r;
}
@@ -3972,7 +3973,7 @@ __cxa_demangle (const char *mangled_name, char *output_buffer,
{
if (strlen (demangled) < *length)
{
- strcpy (output_buffer, demangled);
+ strlcpy (output_buffer, demangled, *length);
free (demangled);
demangled = output_buffer;
}