From: Hanno Boeck Date: Fri, 25 Mar 2016 19:10:15 +0000 (+0900) Subject: lua: Avoid heap buffer overflow X-Git-Tag: v0.19.8~34 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=0571be87e09c6db11be8c56c773b563c2b4c99a4;p=thirdparty%2Fgettext.git 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 --- diff --git a/gettext-tools/src/x-lua.c b/gettext-tools/src/x-lua.c index 0399c49e6..78ac24f1e 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'; }