]> source.dussan.org Git - rspamd.git/commitdiff
Disallow '//' as a single line comment.
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Sat, 12 Oct 2013 09:00:14 +0000 (10:00 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Sat, 12 Oct 2013 09:00:14 +0000 (10:00 +0100)
src/rcl/rcl_parser.c
test/rspamd_rcl_test.c

index 1b09fe2837df24ba16016254d5f305d896c0cead..ac63298c9096971bdab30591018d248232f8132c 100644 (file)
@@ -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;
                }
        }
index 9d8399baf02c2e9688f30dfe1d02f86c2c5fee69..2a93169a613f853526f0f8c44da804ff4a48ba20 100644 (file)
@@ -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"