public inbox for libc-hacker@sourceware.org
 help / color / mirror / Atom feed
From: Andreas Schwab <schwab@redhat.com>
To: libc-hacker@sourceware.org
Subject: [PATCH] Fix alloca accounting in strxfm
Date: Tue, 19 Jul 2011 12:27:00 -0000	[thread overview]
Message-ID: <m3oc0qh2vf.fsf@hase.home> (raw)

2011-07-19  Andreas Schwab  <schwab@redhat.com>

	* string/strxfrm_l.c (STRXFRM): Fix alloca accounting.
---
 string/strxfrm_l.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/string/strxfrm_l.c b/string/strxfrm_l.c
index 351b426..3448f1a 100644
--- a/string/strxfrm_l.c
+++ b/string/strxfrm_l.c
@@ -1,4 +1,4 @@
-/* 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 +150,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];
-- 
1.7.6


-- 
Andreas Schwab, schwab@redhat.com
GPG Key fingerprint = D4E8 DBE3 3813 BB5D FA84  5EC7 45C6 250E 6F00 984E
"And now for something completely different."

             reply	other threads:[~2011-07-19 12:27 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-19 12:27 Andreas Schwab [this message]
2011-07-19 19:05 ` Ulrich Drepper
2011-07-20  7:31   ` Andreas Schwab
2011-07-20 15:39     ` Ulrich Drepper

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m3oc0qh2vf.fsf@hase.home \
    --to=schwab@redhat.com \
    --cc=libc-hacker@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).