From: Vsevolod Stakhov Date: Sat, 12 Oct 2013 09:00:14 +0000 (+0100) Subject: Disallow '//' as a single line comment. X-Git-Tag: 0.6.0~125 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=04c3a653f7bdfe9acfe1e55525d995da7d41ddae;p=thirdparty%2Frspamd.git Disallow '//' as a single line comment. --- diff --git a/src/rcl/rcl_parser.c b/src/rcl/rcl_parser.c index 1b09fe2837..ac63298c90 100644 --- a/src/rcl/rcl_parser.c +++ b/src/rcl/rcl_parser.c @@ -91,19 +91,7 @@ start: } } else if (*p == '/' && chunk->remain >= 2) { - if (p[1] == '/' && parser->state != RSPAMD_RCL_STATE_SCOMMENT && - parser->state != RSPAMD_RCL_STATE_MCOMMENT) { - rspamd_cl_chunk_skipc (chunk, *++p); - chunk->pos = p; - while (p < chunk->end) { - if (*p == '\n') { - rspamd_cl_chunk_skipc (chunk, *++p); - goto start; - } - rspamd_cl_chunk_skipc (chunk, *++p); - } - } - else if (p[1] == '*') { + if (p[1] == '*') { rspamd_cl_chunk_skipc (chunk, *++p); comments_nested ++; rspamd_cl_chunk_skipc (chunk, *++p); @@ -213,7 +201,7 @@ static inline gboolean rspamd_cl_lex_is_comment (const guchar c1, const guchar c2) { if (c1 == '/') { - if (c2 == '/' || c2 == '*') { + if (c2 == '*') { return TRUE; } } diff --git a/test/rspamd_rcl_test.c b/test/rspamd_rcl_test.c index 9d8399baf0..2a93169a61 100644 --- a/test/rspamd_rcl_test.c +++ b/test/rspamd_rcl_test.c @@ -53,6 +53,7 @@ const gchar *rcl_test_valid[] = { "" "#packagesite http//pkg.freebsd.org/freebsd-9-amd64/latest\n" "#packagesite http//pkg.freebsd.org/freebsd-9-amd64/latest\n" + "packagesite: http//pkg.freebsd.org/freebsd-9-amd64/latest\n" "ALIAS : {\n" " all-depends: query %dn-%dv,\n" " annotations: info -A,\n"