]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
msgfmt: Don't overflow the stack with large values for --alignment.
authorCollin Funk <collin.funk1@gmail.com>
Wed, 31 Dec 2025 18:11:47 +0000 (19:11 +0100)
committerBruno Haible <bruno@clisp.org>
Wed, 31 Dec 2025 18:24:40 +0000 (19:24 +0100)
Reported by <maxtodeath@gmail.com> at <https://savannah.gnu.org/bugs/?67743>.

* gettext-tools/src/write-mo.c (write_table): Use xmalloca instead of
alloca to allocate the buffer to fill with NUL bytes.

gettext-tools/src/write-mo.c

index 07f08d30e0dd16f754dd64862ad2824c0d85f4f5..e3b81fef41fa33952f5914829ff3c351c1079a40 100644 (file)
@@ -1010,7 +1010,7 @@ write_table (FILE *output_file, message_list_ty *mlp)
   offset = end_offset;
 
   /* A few zero bytes for padding.  */
-  char *null = (char *) alloca (alignment);
+  char *null = (char *) xmalloca (alignment);
   memset (null, '\0', alignment);
 
   /* Now write the original strings.  */