From: Daiki Ueno Date: Fri, 11 Jul 2014 14:30:52 +0000 (+0900) Subject: c: Fix empty string literal handling X-Git-Tag: v0.19.2~17 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7b2d8d61;p=thirdparty%2Fgettext.git c: Fix empty string literal handling Problem reported by Bernhard Voelker in: . * x-c.c (phase5_get): Add missing memory allocation for empty string literal. --- diff --git a/gettext-tools/src/ChangeLog b/gettext-tools/src/ChangeLog index c5c7e6b9a..111e06081 100644 --- a/gettext-tools/src/ChangeLog +++ b/gettext-tools/src/ChangeLog @@ -1,3 +1,11 @@ +2014-07-11 Daiki Ueno + + c: Fix empty string literal handling + Problem reported by Bernhard Voelker in: + . + * x-c.c (phase5_get): Add missing memory allocation for empty + string literal. + 2014-06-10 Daiki Ueno * gettext 0.19.1 released. diff --git a/gettext-tools/src/x-c.c b/gettext-tools/src/x-c.c index 203eb796f..479b8e8f6 100644 --- a/gettext-tools/src/x-c.c +++ b/gettext-tools/src/x-c.c @@ -1354,6 +1354,11 @@ phase5_get (token_ty *tp) } break; } + if (bufpos >= bufmax) + { + bufmax = 2 * bufmax + 10; + buffer = xrealloc (buffer, bufmax); + } buffer[bufpos] = 0; tp->type = token_type_string_literal; tp->string = xstrdup (buffer);