[v11,1/3] posix: regcomp(): clear RE_DOT_NOT_NULL
Checks
Context |
Check |
Description |
redhat-pt-bot/TryBot-apply_patch |
success
|
Patch applied to master at the time it was sent
|
linaro-tcwg-bot/tcwg_glibc_check--master-aarch64 |
success
|
Testing passed
|
linaro-tcwg-bot/tcwg_glibc_build--master-arm |
success
|
Testing passed
|
linaro-tcwg-bot/tcwg_glibc_check--master-arm |
success
|
Testing passed
|
linaro-tcwg-bot/tcwg_glibc_build--master-aarch64 |
success
|
Testing passed
|
Commit Message
The POSIX API always stops at first NUL so there's no change for that.
The BSD REG_STARTEND API, with its explicit range, can include NULs
within that range, and those NULs are matched with . and [^].
Heretofore, for a string of "a\0c", glibc would match "[^q]c", but not
".c". This is both inconsistent and nonconformant to BSD REG_STARTEND.
With this patch, they're identical like you'd expect, and the
tst-reg-startend.c: ..c: a^@c: no match$
failure is removed.
Another approach would be to remove it from _RE_SYNTAX_POSIX_COMMON,
but it's unclear to me what the custody chain is like for that and what
other regex APIs glibc offers that could be affected by this.
---
Clean rebase, now covered by FSF assignment.
posix/regcomp.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
@@ -462,7 +462,7 @@ regcomp (regex_t *__restrict preg, const char *__restrict pattern, int cflags)
{
reg_errcode_t ret;
reg_syntax_t syntax = ((cflags & REG_EXTENDED) ? RE_SYNTAX_POSIX_EXTENDED
- : RE_SYNTAX_POSIX_BASIC);
+ : RE_SYNTAX_POSIX_BASIC) & ~RE_DOT_NOT_NULL;
preg->buffer = NULL;
preg->allocated = 0;