1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-07-30 22:43:12 +03:00

Fix alloca accounting in strxfm

This commit is contained in:
Andreas Schwab
2011-07-19 15:03:57 -04:00
committed by Ulrich Drepper
parent feb1eb0be7
commit e0e7228480
2 changed files with 7 additions and 2 deletions

View File

@ -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];