bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: quotearg test failures


From: Bruno Haible
Subject: Re: quotearg test failures
Date: Mon, 17 Oct 2016 02:41:46 +0200
User-agent: KMail/4.8.5 (Linux/3.8.0-44-generic; KDE/4.8.5; x86_64; ; )

Hi Pádraig,

> The attached should fix up those tests.

I disagree with the removal of the '%' checks in tests/test-sh-quote.c
and tests/test-system-quote-main.c. These checks are there to guarantee
that the functions won't write past the allocated buffer. For example,
sh-quote.h specifies how large the buffer must be:

/* Copies the quoted string to p and returns the incremented p.
   There must be room for shell_quote_length (string) + 1 bytes at p.  */
extern char * shell_quote_copy (char *p, const char *string);

system-quote.h specifies it similarly:

/* Copies the quoted string to p and returns the incremented p.
   There must be room for system_quote_length (string) + 1 bytes at p.  */
extern char *
       system_quote_copy (char *p,
                          enum system_command_interpreter interpreter,
                          const char *string);

The tests verify this. Please can you restore the checks and instead
see why quotearg now writes more bytes than necessary?

Note that both shell_quote_length and shell_quote_copy are defined
through the 'quotearg' module, with the same options (called
'sh_quoting_options' there). The buffer overrun indicates an internal
inconsistency in the 'quotearg' module.

Bruno




reply via email to

[Prev in Thread] Current Thread [Next in Thread]