]> Savannah Git Hosting - gnulib.git/commit
quotearg: never write beyond the returned length
authorPádraig Brady <pbrady@fb.com>
Tue, 18 Oct 2016 20:00:07 +0000 (13:00 -0700)
committerPádraig Brady <pbrady@fb.com>
Wed, 19 Oct 2016 13:52:57 +0000 (06:52 -0700)
commit8c70d237096675f4cfb3338038c9c92f6b24ea9d
tree90a2c4273d4cc364c7bb17c5db5629046ce5285f
parentf4d66852016a227a506dec28cc4c500b7d045ddd
quotearg: never write beyond the returned length

* lib/quotearg.c (quotearg_buffer_restyled): Switch to a read-only
scan of the string when we initially encounter a single quote when
shell quoting, so that if we then switch to a more concise quoting method
we will not have written beyond that returned length.
This is significant for sh-quote, which has separate routines
to determine the length and do the actual quoting.
* tests/test-quotearg.h: Reinstate the buffer bounds checking
now that we never write more than the returned length.
ChangeLog
lib/quotearg.c
tests/test-quotearg.h