aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Schwab <schwab@redhat.com>2011-07-19 15:03:57 -0400
committerAndreas Schwab <schwab@redhat.com>2011-07-21 12:21:42 +0200
commit680b74830af43c5ff4391d9f7dc8f2e1a3a939d7 (patch)
tree9ebcac35bd65aa001153f53bcefe110cd752e4d2
parentf6244abb8c68c705b8f8bfb3c8adb44dffe5a157 (diff)
downloadglibc-680b74830af43c5ff4391d9f7dc8f2e1a3a939d7.zip
glibc-680b74830af43c5ff4391d9f7dc8f2e1a3a939d7.tar.gz
glibc-680b74830af43c5ff4391d9f7dc8f2e1a3a939d7.tar.bz2
Fix alloca accounting in strxfm
(cherry picked from commit e0e722848005e335132015a64a09cad7f7a12073)
-rw-r--r--ChangeLog4
-rw-r--r--string/strxfrm_l.c5
2 files changed, 7 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index d774296..4beefb4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2011-07-19 Andreas Schwab <schwab@redhat.com>
+
+ * string/strxfrm_l.c (STRXFRM): Fix alloca accounting.
+
2011-07-19 Ulrich Drepper <drepper@gmail.com>
* nscd/nscd.c (termination_handler): Don't do anything for a database
diff --git a/string/strxfrm_l.c b/string/strxfrm_l.c
index 351b426..220253c 100644
--- a/string/strxfrm_l.c
+++ b/string/strxfrm_l.c
@@ -1,4 +1,5 @@
-/* Copyright (C) 1995-1997,2002,2004-2006,2010 Free Software Foundation, Inc.
+/* Copyright (C) 1995-1997,2002,2004-2006,2010,2011
+ Free Software Foundation, Inc.
This file is part of the GNU C Library.
Written by Ulrich Drepper <drepper@gnu.org>, 1995.
@@ -150,7 +151,7 @@ STRXFRM (STRING_TYPE *dest, const STRING_TYPE *src, size_t n, __locale_t l)
values. But since there is no limit on the length of the string
we have to use `malloc' if the string is too long. We should be
very conservative here. */
- if (! __libc_use_alloca (srclen))
+ if (! __libc_use_alloca ((srclen + 1) * (sizeof (int32_t) + 1)))
{
idxarr = (int32_t *) malloc ((srclen + 1) * (sizeof (int32_t) + 1));
rulearr = (unsigned char *) &idxarr[srclen];