]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
intl: Merge from glibc.
authorBruno Haible <bruno@clisp.org>
Sat, 30 Sep 2023 12:52:20 +0000 (14:52 +0200)
committerBruno Haible <bruno@clisp.org>
Sat, 30 Sep 2023 22:36:55 +0000 (00:36 +0200)
Apply commit
2017-03-13  Wilco Dijkstra  <wdijkstr@arm.com>
Remove the str(n)dup inlines from string/bits/string2.h...

gettext-runtime/intl/dcigettext.c
gettext-runtime/intl/finddomain.c

index 64a0dd9351ca572ebb77034dbf51bf6502f33702..4e0f3a2bd175011aa6658b0869569c420d43fc7d 100644 (file)
@@ -132,6 +132,7 @@ extern int errno;
 /* Rename the non ANSI C functions.  This is required by the standard
    because some ANSI C functions will require linking with this object
    file and the name space must not be polluted.  */
+# define strdup __strdup
 # define getcwd __getcwd
 # ifndef stpcpy
 #  define stpcpy __stpcpy
index 9aff02d4a3ae7d9141ec36d97ce12d572600d681..59e7463de8ad2b8f45a5ce813aa75c9c1c8e093b 100644 (file)
@@ -140,9 +140,12 @@ _nl_find_domain (const char *dirname,
   alias_value = _nl_expand_alias (locale);
   if (alias_value != NULL)
     {
-      locale = strdup (alias_value);
+      size_t len = strlen (alias_value) + 1;
+      locale = (char *) malloc (len);
       if (locale == NULL)
-       return NULL;
+        return NULL;
+
+      memcpy (locale, alias_value, len);
     }
 
   /* Now we determine the single parts of the locale name.  First