summary refs log tree commit diff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2003-04-17 02:55:45 +0000
committerUlrich Drepper <drepper@redhat.com>2003-04-17 02:55:45 +0000
commit86d273076ccefde7891e22346ae5bbfa789f26eb (patch)
tree718a46eb0010dc82dc23d4a5cd569b2dd640f853
parent31dfab9e1775a673b18858af13794c50477ac76a (diff)
downloadglibc-86d273076ccefde7891e22346ae5bbfa789f26eb.tar.gz
glibc-86d273076ccefde7891e22346ae5bbfa789f26eb.tar.xz
glibc-86d273076ccefde7891e22346ae5bbfa789f26eb.zip
Update.
	* locale/programs/ld-time.c (TESTARR_ELEM): Make i unsigned.
	(time_output): If necessary, allocate new buffer for .name string if
	padding is required.
-rw-r--r--ChangeLog4
-rw-r--r--locale/programs/ld-time.c11
2 files changed, 11 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index f211511ee2..f24395f0a5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2003-04-16  Ulrich Drepper  <drepper@redhat.com>
 
+	* locale/programs/ld-time.c (TESTARR_ELEM): Make i unsigned.
+	(time_output): If necessary, allocate new buffer for .name string if
+	padding is required.
+
 	* sysdeps/unix/sysv/linux/ifaddrs.c (getifaddrs): Check lengths
 	before copying.  This might leave holes in the list.  Adjust
 	pointers if necessary.
diff --git a/locale/programs/ld-time.c b/locale/programs/ld-time.c
index 2ff56b0034..a9d46597f1 100644
--- a/locale/programs/ld-time.c
+++ b/locale/programs/ld-time.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995-1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+/* Copyright (C) 1995-2002, 2003 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@gnu.org>, 1995.
 
@@ -170,7 +170,7 @@ No definition for %s category found"), "LC_TIME"));
   if (!time->cat##_defined)						      \
     {									      \
       const char *initval[] = { noparen val };				      \
-      int i;								      \
+      unsigned int i;							      \
 									      \
       if (! be_quiet && ! nothing)					      \
 	WITH_CUR_LOCALE (error (0, 0, _("%s: field `%s' not defined"),	      \
@@ -697,10 +697,13 @@ time_output (struct localedef_t *locale, const struct charmap_t *charmap,
       iov[2 + cnt].iov_len = sizeof (int32_t);
       ++cnt;
 
-      l = (strchr (time->era_entries[num].format, '\0')
+      l = ((char *) rawmemchr (time->era_entries[num].format, '\0')
 	   - time->era_entries[num].name) + 1;
       l = (l + 3) & ~3;
-      iov[2 + cnt].iov_base = (void *) time->era_entries[num].name;
+      iov[2 + cnt].iov_base = alloca (l);
+      /* This time we *really* want to use the properties of strncpy.  */
+      strncpy (iov[2 + cnt].iov_base, time->era_entries[num].name,
+	       l);
       iov[2 + cnt].iov_len = l;
       ++cnt;