diff options
author | Johannes Schindelin <johannes.schindelin@gmx.de> | 2016-09-21 20:24:14 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2016-09-21 13:56:15 -0700 |
commit | b7d36ffca02c23f545d6e098d78180e6e72dfd8d (patch) | |
tree | ee20baae52d14d948c581efdbf30aff6fa2ee62e /t/t5100/msg0016--no-inbody-headers | |
parent | regex: add regexec_buf() that can work on a non NUL-terminated string (diff) | |
download | tgif-b7d36ffca02c23f545d6e098d78180e6e72dfd8d.tar.xz |
regex: use regexec_buf()
The new regexec_buf() function operates on buffers with an explicitly
specified length, rather than NUL-terminated strings.
We need to use this function whenever the buffer we want to pass to
regexec(3) may have been mmap(2)ed (and is hence not NUL-terminated).
Note: the original motivation for this patch was to fix a bug where
`git diff -G <regex>` would crash. This patch converts more callers,
though, some of which allocated to construct NUL-terminated strings,
or worse, modified buffers to temporarily insert NULs while calling
regexec(3). By converting them to use regexec_buf(), the code has
become much cleaner.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t5100/msg0016--no-inbody-headers')
0 files changed, 0 insertions, 0 deletions