Module Name: src
Committed By: tnozaki
Date: Sat Jan 21 13:35:49 UTC 2012
Modified Files:
src/lib/libintl: gettext.c
Log Message:
libintl crash when *.mo file lacks header section(old gettext format).
reported by jun@ -san, tested by tsutsui@ -san. thanks!
To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/lib/libintl/gettext.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/lib/libintl/gettext.c
diff -u src/lib/libintl/gettext.c:1.25 src/lib/libintl/gettext.c:1.26
--- src/lib/libintl/gettext.c:1.25 Tue Sep 25 08:19:09 2007
+++ src/lib/libintl/gettext.c Sat Jan 21 13:35:49 2012
@@ -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 @@ mapit(const char *path, struct domainbin
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;