summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gnu/gcc/libstdc++-v3/config/locale/generic/c_locale.h5
-rw-r--r--gnu/gcc/libstdc++-v3/config/locale/gnu/c_locale.h5
-rw-r--r--gnu/gcc/libstdc++-v3/config/locale/gnu/messages_members.h5
-rw-r--r--gnu/gcc/libstdc++-v3/config/os/bsd/openbsd/ctype_inline.h4
-rw-r--r--gnu/gcc/libstdc++-v3/config/os/bsd/openbsd/os_defines.h2
-rw-r--r--gnu/gcc/libstdc++-v3/include/c_std/std_cwctype.h2
-rw-r--r--gnu/gcc/libstdc++-v3/include/ext/throw_allocator.h6
-rw-r--r--gnu/lib/libiberty/src/cp-demangle.c11
8 files changed, 22 insertions, 18 deletions
diff --git a/gnu/gcc/libstdc++-v3/config/locale/generic/c_locale.h b/gnu/gcc/libstdc++-v3/config/locale/generic/c_locale.h
index d180c205f1f..c236883c83b 100644
--- a/gnu/gcc/libstdc++-v3/config/locale/generic/c_locale.h
+++ b/gnu/gcc/libstdc++-v3/config/locale/generic/c_locale.h
@@ -68,8 +68,9 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
char* __sav = NULL;
if (std::strcmp(__old, "C"))
{
- __sav = new char[std::strlen(__old) + 1];
- std::strcpy(__sav, __old);
+ size_t __sz = std::strlen(__old) + 1;
+ __sav = new char[__sz];
+ std::memcpy(__sav, __old, __sz);
std::setlocale(LC_NUMERIC, "C");
}
diff --git a/gnu/gcc/libstdc++-v3/config/locale/gnu/c_locale.h b/gnu/gcc/libstdc++-v3/config/locale/gnu/c_locale.h
index f0b2b7dcaa2..b150c605740 100644
--- a/gnu/gcc/libstdc++-v3/config/locale/gnu/c_locale.h
+++ b/gnu/gcc/libstdc++-v3/config/locale/gnu/c_locale.h
@@ -82,8 +82,9 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
__c_locale __old = __gnu_cxx::__uselocale(__cloc);
#else
char* __old = std::setlocale(LC_ALL, NULL);
- char* __sav = new char[std::strlen(__old) + 1];
- std::strcpy(__sav, __old);
+ size_t __sz = std::strlen(__old) + 1;
+ char* __sav = new char[__sz];
+ std::memcpy(__sav, __old, __sz);
std::setlocale(LC_ALL, "C");
#endif
diff --git a/gnu/gcc/libstdc++-v3/config/locale/gnu/messages_members.h b/gnu/gcc/libstdc++-v3/config/locale/gnu/messages_members.h
index 31504e58bdc..dd2436d6b01 100644
--- a/gnu/gcc/libstdc++-v3/config/locale/gnu/messages_members.h
+++ b/gnu/gcc/libstdc++-v3/config/locale/gnu/messages_members.h
@@ -102,8 +102,9 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
{
if (this->_M_name_messages != locale::facet::_S_get_c_name())
delete [] this->_M_name_messages;
- char* __tmp = new char[std::strlen(__s) + 1];
- std::strcpy(__tmp, __s);
+ size_t __sz = std::strlen(__s) + 1;
+ char* __tmp = new char[__sz];
+ std::memcpy(__tmp, __s, __sz);
this->_M_name_messages = __tmp;
if (std::strcmp(__s, "C") != 0 && std::strcmp(__s, "POSIX") != 0)
diff --git a/gnu/gcc/libstdc++-v3/config/os/bsd/openbsd/ctype_inline.h b/gnu/gcc/libstdc++-v3/config/os/bsd/openbsd/ctype_inline.h
index a00104c3c04..f011c510cc1 100644
--- a/gnu/gcc/libstdc++-v3/config/os/bsd/openbsd/ctype_inline.h
+++ b/gnu/gcc/libstdc++-v3/config/os/bsd/openbsd/ctype_inline.h
@@ -44,14 +44,14 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
bool
ctype<char>::
is(mask __m, char __c) const
- { return _M_table[(unsigned char)(__c)] & __m; }
+ { return (_M_table ? _M_table : _ctype_ + 1)[(unsigned char)(__c)] & __m; }
const char*
ctype<char>::
is(const char* __low, const char* __high, mask* __vec) const
{
while (__low < __high)
- *__vec++ = _M_table[*__low++];
+ *__vec++ = (_M_table ? _M_table : _ctype_ + 1)[*__low++];
return __high;
}
diff --git a/gnu/gcc/libstdc++-v3/config/os/bsd/openbsd/os_defines.h b/gnu/gcc/libstdc++-v3/config/os/bsd/openbsd/os_defines.h
index 7f3e7d88c7a..0460690da5c 100644
--- a/gnu/gcc/libstdc++-v3/config/os/bsd/openbsd/os_defines.h
+++ b/gnu/gcc/libstdc++-v3/config/os/bsd/openbsd/os_defines.h
@@ -34,11 +34,13 @@
// System-specific #define, typedefs, corrections, etc, go here. This
// file will come before all others.
+#define _GLIBCXX_USE_C99 1
#define _GLIBCXX_USE_C99_CHECK 1
#define _GLIBCXX_USE_C99_DYNAMIC (!(__ISO_C_VISIBLE >= 1999))
#define _GLIBCXX_USE_C99_LONG_LONG_CHECK 1
#define _GLIBCXX_USE_C99_LONG_LONG_DYNAMIC (_GLIBCXX_USE_C99_DYNAMIC || !defined __LONG_LONG_SUPPORTED)
#define _GLIBCXX_USE_C99_FLOAT_TRANSCENDENTALS_CHECK 1
#define _GLIBCXX_USE_C99_FLOAT_TRANSCENDENTALS_DYNAMIC defined _XOPEN_SOURCE
+typedef __builtin_va_list __gnuc_va_list;
#endif
diff --git a/gnu/gcc/libstdc++-v3/include/c_std/std_cwctype.h b/gnu/gcc/libstdc++-v3/include/c_std/std_cwctype.h
index d128e04ab1f..dd0032f3dd6 100644
--- a/gnu/gcc/libstdc++-v3/include/c_std/std_cwctype.h
+++ b/gnu/gcc/libstdc++-v3/include/c_std/std_cwctype.h
@@ -81,7 +81,6 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
using ::wint_t; // cwchar
-#if !defined(__OpenBSD__)
using ::wctype_t;
using ::wctrans_t;
@@ -105,7 +104,6 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
using ::towupper;
using ::wctrans;
using ::wctype;
-#endif
_GLIBCXX_END_NAMESPACE
diff --git a/gnu/gcc/libstdc++-v3/include/ext/throw_allocator.h b/gnu/gcc/libstdc++-v3/include/ext/throw_allocator.h
index 5886afc7989..53278f87d82 100644
--- a/gnu/gcc/libstdc++-v3/include/ext/throw_allocator.h
+++ b/gnu/gcc/libstdc++-v3/include/ext/throw_allocator.h
@@ -419,15 +419,15 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
char buf[40];
const char tab('\t');
s += "address: ";
- sprintf(buf, "%p", ref.first);
+ snprintf(buf, sizeof buf, "%p", ref.first);
s += buf;
s += tab;
s += "label: ";
- sprintf(buf, "%u", ref.second.first);
+ snprintf(buf, sizeof buf, "%u", ref.second.first);
s += buf;
s += tab;
s += "size: ";
- sprintf(buf, "%u", ref.second.second);
+ snprintf(buf, sizeof buf, "%u", ref.second.second);
s += buf;
s += '\n';
}
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;
}