diff options
author | Arnold D. Robbins <arnold@skeeve.com> | 2018-09-26 16:27:43 +0300 |
---|---|---|
committer | Arnold D. Robbins <arnold@skeeve.com> | 2018-09-26 16:27:43 +0300 |
commit | b31e1e36d785413939ff46380b9387789054de8b (patch) | |
tree | a9db5199fe30bf71882328dd9432ccb14472f59a /re.c | |
parent | 450251f1adca89a83c7f472b8318baba67a543d4 (diff) | |
parent | 8c5752ed884408c41609d3ae471c04afaf1fb40a (diff) | |
download | egawk-b31e1e36d785413939ff46380b9387789054de8b.tar.gz egawk-b31e1e36d785413939ff46380b9387789054de8b.tar.bz2 egawk-b31e1e36d785413939ff46380b9387789054de8b.zip |
Merge branch 'master' into feature/fix-comments
Diffstat (limited to 're.c')
-rw-r--r-- | re.c | 12 |
1 files changed, 12 insertions, 0 deletions
@@ -51,6 +51,12 @@ make_regexp(const char *s, size_t len, bool ignorecase, bool dfa, bool canfatal) static bool no_dfa = false; int i; static struct dfa* dfaregs[2] = { NULL, NULL }; + static bool nul_warned = false; + + if (do_lint && ! nul_warned && memchr(s, '\0', len) != NULL) { + nul_warned = true; + lintwarn(_("behavior of matching a regexp containing NUL characters is not defined by POSIX")); + } /* * The number of bytes in the current multibyte character. @@ -148,6 +154,12 @@ make_regexp(const char *s, size_t len, bool ignorecase, bool dfa, bool canfatal) && strchr("()|*+?.^$\\[]", c2) != NULL) *dest++ = '\\'; *dest++ = (char) c2; + if (do_lint + && ! nul_warned + && c2 == '\0') { + nul_warned = true; + lintwarn(_("behavior of matching a regexp containing NUL characters is not defined by POSIX")); + } break; case '8': case '9': /* a\9b not valid */ |