about summary refs log tree commit diff
path: root/locale/programs/ld-time.c
diff options
context:
space:
mode:
Diffstat (limited to 'locale/programs/ld-time.c')
-rw-r--r--locale/programs/ld-time.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/locale/programs/ld-time.c b/locale/programs/ld-time.c
index a9d46597f1..f0a0f0fff7 100644
--- a/locale/programs/ld-time.c
+++ b/locale/programs/ld-time.c
@@ -670,7 +670,7 @@ time_output (struct localedef_t *locale, const struct charmap_t *charmap,
   idx[1 + last_idx] = idx[last_idx];
   for (num = 0; num < time->num_era; ++num)
     {
-      size_t l;
+      size_t l, l2;
 
       iov[2 + cnt].iov_base = (void *) &time->era_entries[num].direction;
       iov[2 + cnt].iov_len = sizeof (int32_t);
@@ -699,15 +699,14 @@ time_output (struct localedef_t *locale, const struct charmap_t *charmap,
 
       l = ((char *) rawmemchr (time->era_entries[num].format, '\0')
 	   - time->era_entries[num].name) + 1;
-      l = (l + 3) & ~3;
-      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;
+      l2 = (l + 3) & ~3;
+      iov[2 + cnt].iov_base = alloca (l2);
+      memset (mempcpy (iov[2 + cnt].iov_base, time->era_entries[num].name, l),
+	      '\0', l2 - l);
+      iov[2 + cnt].iov_len = l2;
       ++cnt;
 
-      idx[1 + last_idx] += 8 * sizeof (int32_t) + l;
+      idx[1 + last_idx] += 8 * sizeof (int32_t) + l2;
 
       assert (idx[1 + last_idx] % 4 == 0);