$OpenBSD: patch-gettext-runtime_intl_dcigettext_c,v 1.2 2010/07/03 03:23:22 naddy Exp $
--- gettext-runtime/intl/dcigettext.c.orig	Mon Jun 28 20:23:14 2010
+++ gettext-runtime/intl/dcigettext.c	Mon Jun 28 20:25:07 2010
@@ -769,13 +769,17 @@ DCIGETTEXT (const char *domainname, const char *msgid1
 		  /* Create a new entry and add it to the search tree.  */
 		  size_t msgid_len;
 		  size_t size;
+#ifdef HAVE_PER_THREAD_LOCALE
+		  size_t localename_len;
+#endif
 		  struct known_translation_t *newp;
 
 		  msgid_len = strlen (msgid1) + 1;
 		  size = offsetof (struct known_translation_t, msgid)
 			 + msgid_len + domainname_len + 1;
 #ifdef HAVE_PER_THREAD_LOCALE
-		  size += strlen (localename) + 1;
+		  localename_len = strlen (localename);
+		  size += localename_len + 1;
 #endif
 		  newp = (struct known_translation_t *) malloc (size);
 		  if (newp != NULL)
@@ -791,7 +795,7 @@ DCIGETTEXT (const char *domainname, const char *msgid1
 		      memcpy (new_domainname, domainname, domainname_len + 1);
 #ifdef HAVE_PER_THREAD_LOCALE
 		      new_localename = new_domainname + domainname_len + 1;
-		      strcpy (new_localename, localename);
+		      memcpy (new_localename, localename, localename_len + 1);
 #endif
 		      newp->domainname = new_domainname;
 		      newp->category = category;
