aboutsummaryrefslogtreecommitdiff
path: root/string
diff options
context:
space:
mode:
authorAndreas Schwab <schwab@redhat.com>2011-07-19 15:03:57 -0400
committerUlrich Drepper <drepper@gmail.com>2011-07-19 15:03:57 -0400
commite0e722848005e335132015a64a09cad7f7a12073 (patch)
tree734a5619a7939852b5f53b7970f8f6599ea26d13 /string
parentfeb1eb0be78b40d53c71474f07d1b0517ba95586 (diff)
downloadglibc-e0e722848005e335132015a64a09cad7f7a12073.tar
glibc-e0e722848005e335132015a64a09cad7f7a12073.tar.gz
glibc-e0e722848005e335132015a64a09cad7f7a12073.tar.bz2
glibc-e0e722848005e335132015a64a09cad7f7a12073.zip
Fix alloca accounting in strxfm
Diffstat (limited to 'string')
-rw-r--r--string/strxfrm_l.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/string/strxfrm_l.c b/string/strxfrm_l.c
index 351b426541..220253c4d6 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];