]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
c: Fix empty string literal handling
authorDaiki Ueno <ueno@gnu.org>
Fri, 11 Jul 2014 14:30:52 +0000 (23:30 +0900)
committerDaiki Ueno <ueno@gnu.org>
Fri, 11 Jul 2014 14:32:37 +0000 (23:32 +0900)
Problem reported by Bernhard Voelker in:
<http://lists.gnu.org/archive/html/bug-gnulib/2014-07/msg00059.html>.
* x-c.c (phase5_get): Add missing memory allocation for empty
string literal.

gettext-tools/src/ChangeLog
gettext-tools/src/x-c.c

index c5c7e6b9a304d7baa53105fad3e55bb4dfa19ecb..111e060817fc26562327641d3e47957bcc544ef7 100644 (file)
@@ -1,3 +1,11 @@
+2014-07-11  Daiki Ueno  <ueno@gnu.org>
+
+       c: Fix empty string literal handling
+       Problem reported by Bernhard Voelker in:
+       <http://lists.gnu.org/archive/html/bug-gnulib/2014-07/msg00059.html>.
+       * x-c.c (phase5_get): Add missing memory allocation for empty
+       string literal.
+
 2014-06-10  Daiki Ueno  <ueno@gnu.org>
 
        * gettext 0.19.1 released.
index 203eb796f1e57b9734779475ca89f09b93914665..479b8e8f6853569a37e9a2cf4cd5b0ca630d5568 100644 (file)
@@ -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);