From: Bruno Haible Date: Mon, 24 Apr 2023 11:56:46 +0000 (+0200) Subject: system-quote: Fix memory overrun bug on native Windows. X-Git-Tag: v1.0~1387 X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=ee84e6ad5b5fcb1908f426115f6376ed515b5dd2;p=gnulib.git system-quote: Fix memory overrun bug on native Windows. * lib/system-quote.c (system_quote): Allocate enough space for the result. --- diff --git a/ChangeLog b/ChangeLog index e9c911de8f..a49d18a10e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2023-04-24 Bruno Haible + + system-quote: Fix memory overrun bug on native Windows. + * lib/system-quote.c (system_quote): Allocate enough space for the + result. + 2023-04-24 Bruno Haible unicodeio tests: Avoid test failures on native Windows. diff --git a/lib/system-quote.c b/lib/system-quote.c index c08d2dcd53..54e891d98e 100644 --- a/lib/system-quote.c +++ b/lib/system-quote.c @@ -257,7 +257,7 @@ system_quote (enum system_command_interpreter interpreter, case SCI_SYSTEM: case SCI_WINDOWS_CMD: { - size_t length = system_quote_length (interpreter, string); + size_t length = system_quote_length (interpreter, string) + 1; char *quoted = XNMALLOC (length, char); system_quote_copy (quoted, interpreter, string); return quoted;