$OpenBSD: patch-gettext-runtime_intl_dcigettext_c,v 1.1 2008/06/13 04:56:34 naddy Exp $ --- gettext-runtime/intl/dcigettext.c.orig Sun Oct 21 20:41:41 2007 +++ gettext-runtime/intl/dcigettext.c Mon Jun 2 22:58:10 2008 @@ -774,12 +774,16 @@ DCIGETTEXT (const char *domainname, const char *msgid1 { /* Create a new entry and add it to the search tree. */ size_t size; +#ifdef HAVE_PER_THREAD_LOCALE + size_t localename_len; +#endif struct known_translation_t *newp; 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) @@ -794,7 +798,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;