summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaiki Ueno <ueno@gnu.org>2015-06-24 23:23:22 +0900
committerDaiki Ueno <ueno@gnu.org>2015-06-24 23:23:22 +0900
commit8d2352554f8628c59b080b061df61cbe4947b83e (patch)
treee128d795c8d2b2c222d0182a2b92189cc2584221
parentb10f9e2ec6d19d3317dc43e95f3e2474c1dfa14a (diff)
downloadexternal_gettext-8d2352554f8628c59b080b061df61cbe4947b83e.zip
external_gettext-8d2352554f8628c59b080b061df61cbe4947b83e.tar.gz
external_gettext-8d2352554f8628c59b080b061df61cbe4947b83e.tar.bz2
xgettext: avoid out-of-bounds read in literals
* gettext-tools/src/x-c.c (literalstring_parse): Check if the next character of a backslash is NUL. Reported by Hanno Boeck in: <http://savannah.gnu.org/bugs/?45391>.
-rw-r--r--gettext-tools/src/ChangeLog7
-rw-r--r--gettext-tools/src/x-c.c2
2 files changed, 9 insertions, 0 deletions
diff --git a/gettext-tools/src/ChangeLog b/gettext-tools/src/ChangeLog
index 9974a1c..0b7dbe1 100644
--- a/gettext-tools/src/ChangeLog
+++ b/gettext-tools/src/ChangeLog
@@ -1,3 +1,10 @@
+2015-06-24 Daiki Ueno <ueno@gnu.org>
+
+ * x-c.c (literalstring_parse): Check if the next character of a
+ backslash is NUL.
+ Reported by Hanno Boeck in:
+ <http://savannah.gnu.org/bugs/?45391>.
+
2015-06-23 Daiki Ueno <ueno@gnu.org>
* cldr-plurals.c (main): Fix unmatched braces when
diff --git a/gettext-tools/src/x-c.c b/gettext-tools/src/x-c.c
index b5bc7b0..f6922f8 100644
--- a/gettext-tools/src/x-c.c
+++ b/gettext-tools/src/x-c.c
@@ -1002,6 +1002,8 @@ literalstring_parse (const char *string, lex_pos_ty *pos,
}
c = *++p;
+ if (c == '\0')
+ break;
if (type & LET_ANSI_C)
switch (c)