It turns out I introduced an error with the stpcpy() removal changes.

Specifically, an unterminated string is passed as destination to
strlcat() and finally ends up as an argument to strcmp().

Unfortunately this bug didn't show on the package build cluster,
but when I ran a bulk build at home with LANG set and malloc.conf
-> S, I got a number of coredumps from gtar, gmake, etc.

Below is the fix.  This is also a candidate for 5.2-stable.

Christian Schulte sent a similar patch.

Index: Makefile
===================================================================
RCS file: /cvs/ports/devel/gettext/Makefile,v
retrieving revision 1.56
diff -u -p -r1.56 Makefile
--- Makefile    13 Jul 2012 19:43:18 -0000      1.56
+++ Makefile    29 Jul 2012 14:41:42 -0000
@@ -3,7 +3,7 @@
 COMMENT=       GNU gettext
 
 DISTNAME=      gettext-0.18.1
-REVISION=      2
+REVISION=      3
 SHARED_LIBS +=  intl                 6.0      # .9.1
 SHARED_LIBS +=  asprintf             1.0      # .0.0
 SHARED_LIBS +=  gettextlib           3.0      # .0.0
Index: patches/patch-gettext-runtime_intl_l10nflist_c
===================================================================
RCS file: 
/cvs/ports/devel/gettext/patches/patch-gettext-runtime_intl_l10nflist_c,v
retrieving revision 1.1
diff -u -p -r1.1 patch-gettext-runtime_intl_l10nflist_c
--- patches/patch-gettext-runtime_intl_l10nflist_c      13 Jul 2012 19:43:18 
-0000      1.1
+++ patches/patch-gettext-runtime_intl_l10nflist_c      29 Jul 2012 14:41:42 
-0000
@@ -1,6 +1,6 @@
 $OpenBSD: patch-gettext-runtime_intl_l10nflist_c,v 1.1 2012/07/13 19:43:18 
naddy Exp $
 --- gettext-runtime/intl/l10nflist.c.orig      Sun Jun 28 21:44:04 2009
-+++ gettext-runtime/intl/l10nflist.c   Tue Jul 10 23:41:41 2012
++++ gettext-runtime/intl/l10nflist.c   Sun Jul 29 16:27:13 2012
 @@ -183,6 +183,7 @@ _nl_make_l10nflist (struct loaded_l10nfile **l10nfile_
    struct loaded_l10nfile **lastp;
    struct loaded_l10nfile *retval;
@@ -26,9 +26,11 @@ $OpenBSD: patch-gettext-runtime_intl_l10
  
    if (abs_filename == NULL)
      return NULL;
-@@ -218,31 +220,31 @@ _nl_make_l10nflist (struct loaded_l10nfile **l10nfile_
+@@ -217,32 +219,33 @@ _nl_make_l10nflist (struct loaded_l10nfile **l10nfile_
+       cp += dirlist_len;
        cp[-1] = '/';
      }
++  *cp = '\0';
  
 -  cp = stpcpy (cp, language);
 +  strlcat (abs_filename, language, abs_filename_len);
@@ -69,7 +71,7 @@ $OpenBSD: patch-gettext-runtime_intl_l10
  
    /* Look in list of already loaded domains whether it is already
       available.  */
-@@ -366,7 +368,7 @@ _nl_normalize_codeset (const char *codeset, size_t nam
+@@ -366,7 +369,7 @@ _nl_normalize_codeset (const char *codeset, size_t nam
    if (retval != NULL)
      {
        if (only_digit)
-- 
Christian "naddy" Weisgerber                          na...@mips.inka.de

Reply via email to