diff options
author | Vsevolod Stakhov <vsevolod@rspamd.com> | 2022-11-21 17:50:02 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@rspamd.com> | 2022-11-21 17:50:02 +0000 |
commit | b8311035d0b4cde1047568260e997e861f0f318c (patch) | |
tree | fa7b62ba0b6b03cffbf0e03356d66f000dc105d2 | |
parent | fc856fffe2a2ef0a7dfbacad372c7f6ca8b3a586 (diff) | |
download | rspamd-b8311035d0b4cde1047568260e997e861f0f318c.tar.gz rspamd-b8311035d0b4cde1047568260e997e861f0f318c.zip |
[Fix] Fix off-by-one error in css tokenizer
-rw-r--r-- | src/libserver/css/css_tokeniser.cxx | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/libserver/css/css_tokeniser.cxx b/src/libserver/css/css_tokeniser.cxx index ace94cae2..f3c010f1e 100644 --- a/src/libserver/css/css_tokeniser.cxx +++ b/src/libserver/css/css_tokeniser.cxx @@ -557,7 +557,13 @@ auto css_tokeniser::next_token(void) -> struct css_parser_token case '"': case '\'': offset = i + 1; - return make_token<css_parser_token::token_type::string_token>(consume_string(c)); + if (offset < input.size()) { + return make_token<css_parser_token::token_type::string_token>(consume_string(c)); + } + else { + /* Unpaired quote at the end of the rule */ + return make_token<css_parser_token::token_type::delim_token>(c); + } case '(': offset = i + 1; return make_token<css_parser_token::token_type::obrace_token>(); |