]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
lua: Avoid heap buffer overflow
authorHanno Boeck <hanno@gentoo.org>
Fri, 25 Mar 2016 19:10:15 +0000 (04:10 +0900)
committerDaiki Ueno <ueno@gnu.org>
Fri, 25 Mar 2016 19:17:40 +0000 (04:17 +0900)
* gettext-tools/src/x-lua.c (string_end): Allocate a room for
terminating NUL.  Reported in: http://savannah.gnu.org/bugs/?4753

Copyright-paperwork-exempt: yes

gettext-tools/src/x-lua.c

index 0399c49e6c622fa3d4ef1515d7cf5f7cc6a489f1..78ac24f1e0ed5e53d3a6c98733edb51ac3455f1f 100644 (file)
@@ -451,6 +451,12 @@ string_add (int c)
 static void
 string_end ()
 {
+  if (string_buf_length >= string_buf_alloc)
+    {
+      string_buf_alloc = string_buf_alloc + 1;
+      string_buf = xrealloc (string_buf, string_buf_alloc);
+    }
+
   string_buf[string_buf_length] = '\0';
 }