summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2023-04-24 13:56:46 +0200
committerBruno Haible <bruno@clisp.org>2023-04-24 13:56:46 +0200
commitee84e6ad5b5fcb1908f426115f6376ed515b5dd2 (patch)
treeec0a0eb84ac8f47452e5c60939c23820a12cc59b /lib
parentb9a770fc36076e4b2d641d9d61e804cb13826f78 (diff)
downloadgnulib-ee84e6ad5b5fcb1908f426115f6376ed515b5dd2.tar.gz
system-quote: Fix memory overrun bug on native Windows.
* lib/system-quote.c (system_quote): Allocate enough space for the result.
Diffstat (limited to 'lib')
-rw-r--r--lib/system-quote.c2
1 files changed, 1 insertions, 1 deletions
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;