Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/libintl libintl crash when *.mo file lacks header sectio...



details:   https://anonhg.NetBSD.org/src/rev/abc82cbd1d44
branches:  trunk
changeset: 772908:abc82cbd1d44
user:      tnozaki <tnozaki%NetBSD.org@localhost>
date:      Sat Jan 21 13:35:49 2012 +0000

description:
libintl crash when *.mo file lacks header section(old gettext format).
reported by jun@ -san, tested by tsutsui@ -san. thanks!

diffstat:

 lib/libintl/gettext.c |  7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diffs (28 lines):

diff -r d3114a87cf5d -r abc82cbd1d44 lib/libintl/gettext.c
--- a/lib/libintl/gettext.c     Sat Jan 21 12:53:04 2012 +0000
+++ b/lib/libintl/gettext.c     Sat Jan 21 13:35:49 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: gettext.c,v 1.25 2007/09/25 08:19:09 junyoung Exp $    */
+/*     $NetBSD: gettext.c,v 1.26 2012/01/21 13:35:49 tnozaki Exp $     */
 
 /*-
  * Copyright (c) 2000, 2001 Citrus Project,
@@ -29,7 +29,7 @@
  */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: gettext.c,v 1.25 2007/09/25 08:19:09 junyoung Exp $");
+__RCSID("$NetBSD: gettext.c,v 1.26 2012/01/21 13:35:49 tnozaki Exp $");
 
 #include <sys/param.h>
 #include <sys/stat.h>
@@ -624,7 +624,8 @@
                if (v)
                        *v = '\0';
        }
-       if (_gettext_parse_plural(&mohandle->mo.mo_plural,
+       if (!mohandle->mo.mo_header ||
+           _gettext_parse_plural(&mohandle->mo.mo_plural,
                                  &mohandle->mo.mo_nplurals,
                                  mohandle->mo.mo_header, headerlen))
                mohandle->mo.mo_plural = NULL;



Home | Main Index | Thread Index | Old Index