diff options
author | Johannes Schindelin <johannes.schindelin@gmx.de> | 2016-09-21 20:24:04 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2016-09-21 13:56:15 -0700 |
commit | 2f8952250a84313b74f96abb7b035874854cf202 (patch) | |
tree | 264e571b5f86d2a4cf01117630089ac3c94e97fe /Documentation/RelNotes/1.5.6.1.txt | |
parent | regex: -G<pattern> feeds a non NUL-terminated string to regexec() and fails (diff) | |
download | tgif-2f8952250a84313b74f96abb7b035874854cf202.tar.xz |
regex: add regexec_buf() that can work on a non NUL-terminated string
We just introduced a test that demonstrates that our sloppy use of
regexec() on a mmap()ed area can result in incorrect results or even
hard crashes.
So what we need to fix this is a function that calls regexec() on a
length-delimited, rather than a NUL-terminated, string.
Happily, there is an extension to regexec() introduced by the NetBSD
project and present in all major regex implementation including
Linux', MacOSX' and the one Git includes in compat/regex/: by using
the (non-POSIX) REG_STARTEND flag, it is possible to tell the
regexec() function that it should only look at the offsets between
pmatch[0].rm_so and pmatch[0].rm_eo.
That is exactly what we need.
Since support for REG_STARTEND is so widespread by now, let's just
introduce a helper function that always uses it, and tell people
on a platform whose regex library does not support it to use the
one from our compat/regex/ directory.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'Documentation/RelNotes/1.5.6.1.txt')
0 files changed, 0 insertions, 0 deletions