diff options
author | Arnold D. Robbins <arnold@skeeve.com> | 2018-09-21 13:15:38 +0300 |
---|---|---|
committer | Arnold D. Robbins <arnold@skeeve.com> | 2018-09-21 13:15:38 +0300 |
commit | 5e4861ab4c41b6e000dc1f66225486330b5e5a2d (patch) | |
tree | a9da099527a1967356381e93512126f813605d0a /re.c | |
parent | f6a89a9b3ecd956e97b61719ea0d634886ace814 (diff) | |
download | egawk-5e4861ab4c41b6e000dc1f66225486330b5e5a2d.tar.gz egawk-5e4861ab4c41b6e000dc1f66225486330b5e5a2d.tar.bz2 egawk-5e4861ab4c41b6e000dc1f66225486330b5e5a2d.zip |
Bug fix for trailing backslash in dynamic regexp.
Diffstat (limited to 're.c')
-rw-r--r-- | re.c | 8 |
1 files changed, 7 insertions, 1 deletions
@@ -112,6 +112,12 @@ make_regexp(const char *s, size_t len, bool ignorecase, bool dfa, bool canfatal) (*src == '\\')) { c = *++src; switch (c) { + case '\0': /* \\ before \0, either dynamic data or real end of string */ + if (src >= s + len) + *dest++ = '\\'; // at end of string, will fatal below + else + fatal(_("invalid NUL byte in dynamic regexp")); + break; case 'a': case 'b': case 'f': @@ -241,7 +247,7 @@ make_regexp(const char *s, size_t len, bool ignorecase, bool dfa, bool canfatal) error("%s: /%s/", rerr, buf); return NULL; } - fatal("%s: /%s/", rerr, buf); + fatal("invalid regexp: %s: /%s/", rerr, buf); } /* gack. this must be done *after* re_compile_pattern */ |