about summary refs log tree commit diff
path: root/locale/loadlocale.c
diff options
context:
space:
mode:
Diffstat (limited to 'locale/loadlocale.c')
-rw-r--r--locale/loadlocale.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/locale/loadlocale.c b/locale/loadlocale.c
index c762b77ed1..24d0c3a67d 100644
--- a/locale/loadlocale.c
+++ b/locale/loadlocale.c
@@ -97,13 +97,17 @@ _nl_load_locale (struct loaded_l10nfile *file, int category)
       /* LOCALE/LC_foo is a directory; open LOCALE/LC_foo/SYS_LC_foo
            instead.  */
       char *newp;
+      size_t filenamelen;
 
       __close (fd);
 
-      newp = (char *) alloca (strlen (file->filename)
+      filenamelen = strlen (file->filename);
+      newp = (char *) alloca (filenamelen
 			      + 5 + _nl_category_name_sizes[category] + 1);
-      __stpcpy (__stpcpy (__stpcpy (newp, file->filename), "/SYS_"),
-		_nl_category_names[category]);
+      __mempcpy (__mempcpy (__mempcpy (newp, file->filename, filenamelen),
+			    "/SYS_", 5),
+		 _nl_category_names[category],
+		 _nl_category_name_sizes[category] + 1);
 
       fd = __open (newp, O_RDONLY);
       if (fd < 0)