diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2021-07-19 19:57:59 -0700 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2021-07-19 19:57:59 -0700 |
| commit | cc84c3d7916640b75ca4dc0785f9b1f417df1664 (patch) | |
| tree | 81af5d71f4376154796636307c1b9e74ebd91c66 /pattern.c | |
| parent | 711fe47a7f651f38e090c9a20ecef11feba6f705 (diff) | |
Made escape sequence handling stricter: no longer supporting arbitrary
characters, only special escapes like \n, hex sequences like \x0a, octal
sequences like \012, and backslashes \\
Diffstat (limited to 'pattern.c')
| -rw-r--r-- | pattern.c | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -306,9 +306,11 @@ static pat_t *_bp_simplepattern(file_t *f, const char *str) const char *opstart = str; unsigned char e = (unsigned char)unescapechar(str, &str); + if (str == opstart) + file_err(f, start, str, "This isn't a valid escape sequence."); if (matchchar(&str, '-')) { // Escape range (e.g. \x00-\xFF) if (next_char(f, str) != str+1) - file_err(f, start, next_char(f, str), "Sorry, UTF8 escape sequences are not supported."); + file_err(f, start, next_char(f, str), "Sorry, UTF8 escape sequences are not supported in ranges."); const char *seqstart = str; unsigned char e2 = (unsigned char)unescapechar(str, &str); if (str == seqstart) |
