From 0571be87e09c6db11be8c56c773b563c2b4c99a4 Mon Sep 17 00:00:00 2001 From: Hanno Boeck Date: Sat, 26 Mar 2016 04:10:15 +0900 Subject: lua: Avoid heap buffer overflow * 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 | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/gettext-tools/src/x-lua.c b/gettext-tools/src/x-lua.c index 0399c49..78ac24f 100644 --- a/gettext-tools/src/x-lua.c +++ b/gettext-tools/src/x-lua.c @@ -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'; } -- cgit v1.1