aboutsummaryrefslogtreecommitdiffstats
path: root/re.c
diff options
context:
space:
mode:
authorArnold D. Robbins <arnold@skeeve.com>2018-09-21 13:16:41 +0300
committerArnold D. Robbins <arnold@skeeve.com>2018-09-21 13:16:41 +0300
commitb1d75cf79c57071f55fcb6100a07d8cd706e890f (patch)
treea96e04d38fb68f7ee1dee2bd10f79f778239cf03 /re.c
parenta7c32b55995136013af2bff2a0fe4d6c69678cb7 (diff)
parent5e4861ab4c41b6e000dc1f66225486330b5e5a2d (diff)
downloadegawk-b1d75cf79c57071f55fcb6100a07d8cd706e890f.tar.gz
egawk-b1d75cf79c57071f55fcb6100a07d8cd706e890f.tar.bz2
egawk-b1d75cf79c57071f55fcb6100a07d8cd706e890f.zip
Merge branch 'gawk-4.2-stable'
Diffstat (limited to 're.c')
-rw-r--r--re.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/re.c b/re.c
index eefdfcd7..a693a9ad 100644
--- a/re.c
+++ b/re.c
@@ -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 */