summaryrefslogtreecommitdiff
path: root/string/strxfrm.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2002-01-29 03:56:50 +0000
committerUlrich Drepper <drepper@redhat.com>2002-01-29 03:56:50 +0000
commit0295d2666c248045942f7ed753b2d8f8cea0996f (patch)
tree8cd2e60bf904dabf9c1ce077de88658636d7de18 /string/strxfrm.c
parent2e8fb4022506a0a0a747c82fa8cb72140e855adf (diff)
Update.
2002-01-23 Richard Henderson <rth@redhat.com> * sysdeps/alpha/Makefile (pic-ccflag): New variable. 2002-01-28 Ulrich Drepper <drepper@redhat.com> * string/strxfrm.c: Allocate one more byte for rulearr and clear this element [PR libc/2855]. * string/strcoll.c: Handle zero-length arguments specially [PR libc/2856]. 2002-01-23 Jakub Jelinek <jakub@redhat.com> * string/bits/string2.h (__mempcpy): For gcc 3.0+, don't use __mempcpy_small but instead use __builtin_memcpy ( , , n) + n for short lengths and constant src. (strcpy): Don't optimize for gcc 3.0+. (__stpcpy): For gcc 3.0+, don't use __stpcpy_small but instead use __builtin_strcpy (, src) + strlen (src) for short string literal src. 2002-01-23 Jeroen Dobbelaere <jeroen.dobbelaere@acunia.com> * sysdeps/unix/sysv/linux/configure.in (libc_cv_gcc_unwind_find_fde): Set for arm, too. 2001-01-22 Paul Eggert <eggert@twinsun.com> * manual/llio.texi (Linked Channels, Cleaning Streams): Make it clearer that a just-opened input stream might need cleaning. 2002-01-21 H.J. Lu <hjl@gnu.org> * sysdeps/mips/dl-machine.h (ELF_MACHINE_BEFORE_RTLD_RELOC): Don't use label at end of compound statement.
Diffstat (limited to 'string/strxfrm.c')
-rw-r--r--string/strxfrm.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/string/strxfrm.c b/string/strxfrm.c
index 257ce495db..c53dad5555 100644
--- a/string/strxfrm.c
+++ b/string/strxfrm.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995-1999,2000,2001 Free Software Foundation, Inc.
+/* Copyright (C) 1995-1999,2000,2001,2002 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Written by Ulrich Drepper <drepper@cygnus.com>, 1995.
@@ -177,7 +177,7 @@ STRXFRM (STRING_TYPE *dest, const STRING_TYPE *src, size_t n, __locale_t l)
very conservative here. */
if (srclen >= 16384)
{
- idxarr = (int32_t *) malloc (srclen * (sizeof (int32_t) + 1));
+ idxarr = (int32_t *) malloc ((srclen + 1) * (sizeof (int32_t) + 1));
rulearr = (unsigned char *) &idxarr[srclen];
if (idxarr == NULL)
@@ -194,8 +194,11 @@ STRXFRM (STRING_TYPE *dest, const STRING_TYPE *src, size_t n, __locale_t l)
{
try_stack:
idxarr = (int32_t *) alloca (srclen * sizeof (int32_t));
- rulearr = (unsigned char *) alloca (srclen);
+ rulearr = (unsigned char *) alloca (srclen + 1);
}
+ /* This element is only read, the value never used but to determine
+ another value which then is ignored. */
+ rulearr[srclen] = '\0';
idxmax = 0;
do