summary refs log tree commit diff
path: root/string
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2003-04-14 07:03:40 +0000
committerUlrich Drepper <drepper@redhat.com>2003-04-14 07:03:40 +0000
commit39a46c42f5d31566573fceb6691a547c3b3b1e74 (patch)
tree5361a517321769896142944b1ccd2e231cd1c5ed /string
parent4ae7142df21b7f614f7b55e8c272ee19cc8ec2d4 (diff)
downloadglibc-39a46c42f5d31566573fceb6691a547c3b3b1e74.tar.gz
glibc-39a46c42f5d31566573fceb6691a547c3b3b1e74.tar.xz
glibc-39a46c42f5d31566573fceb6691a547c3b3b1e74.zip
Update.
2003-04-14  Ulrich Drepper  <drepper@redhat.com>

	* string/strxfrm.c (STRXFRM): Terminate rulearr at correct
	position.  Reported by jreiser@BitWagon.com.
Diffstat (limited to 'string')
-rw-r--r--string/strxfrm.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/string/strxfrm.c b/string/strxfrm.c
index 6475fa9206..9db57829d9 100644
--- a/string/strxfrm.c
+++ b/string/strxfrm.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995-1999,2000,2001,2002 Free Software Foundation, Inc.
+/* Copyright (C) 1995-1999,2000,2001,2002,2003 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Written by Ulrich Drepper <drepper@cygnus.com>, 1995.
 
@@ -196,9 +196,6 @@ STRXFRM (STRING_TYPE *dest, const STRING_TYPE *src, size_t n, __locale_t l)
       idxarr = (int32_t *) alloca (srclen * sizeof (int32_t));
       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
@@ -211,6 +208,10 @@ STRXFRM (STRING_TYPE *dest, const STRING_TYPE *src, size_t n, __locale_t l)
     }
   while (*usrc != L('\0'));
 
+  /* This element is only read, the value never used but to determine
+     another value which then is ignored.  */
+  rulearr[idxmax] = '\0';
+
   /* Now the passes over the weights.  We now use the indeces we found
      before.  */
   needed = 0;