]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
filestore: fix parsing bug
authorVictor Julien <victor@inliniac.net>
Tue, 30 Sep 2014 07:56:41 +0000 (09:56 +0200)
committerVictor Julien <victor@inliniac.net>
Wed, 1 Oct 2014 12:38:01 +0000 (14:38 +0200)
Filestore keyword can have options or no options, and the parser
was enforcing the NOOPT flag too strictly.

Bug #1288

src/detect-filestore.c
src/detect-parse.c
src/detect.h

index 6ec5b5f8e546d23c9394ff103dc07fa055b37734..f9bfdf55c25b01d923c31b6a38c6307efc1e2fcd 100644 (file)
@@ -77,7 +77,7 @@ void DetectFilestoreRegister(void)
     sigmatch_table[DETECT_FILESTORE].Setup = DetectFilestoreSetup;
     sigmatch_table[DETECT_FILESTORE].Free  = DetectFilestoreFree;
     sigmatch_table[DETECT_FILESTORE].RegisterTests = NULL;
-    sigmatch_table[DETECT_FILESTORE].flags = SIGMATCH_NOOPT;
+    sigmatch_table[DETECT_FILESTORE].flags = SIGMATCH_OPTIONAL_OPT;
 
     const char *eb;
     int eo;
index 1a5d683b25e188ba2bb57b0d85ad628f1f80e7eb..a94b546be35a759346bd83145fa2c918b6734037 100644 (file)
@@ -552,7 +552,7 @@ static int SigParseOptions(DetectEngineCtx *de_ctx, Signature *s, char *optstr,
         }
     }
 
-    if (!(st->flags & SIGMATCH_NOOPT)) {
+    if (!(st->flags & (SIGMATCH_NOOPT|SIGMATCH_OPTIONAL_OPT))) {
         if (strlen(optvalue) == 0) {
             SCLogError(SC_ERR_INVALID_SIGNATURE, "invalid formatting or malformed option to %s keyword: \'%s\'",
                     optname, optstr);
index 432b70500db84de53596584e2cd54fb5dfe8effa..a3a7d4a7defcb9f8adab1d65e97e7f59d2641602 100644 (file)
@@ -1023,6 +1023,9 @@ typedef struct SigGroupHead_ {
 #define SIGMATCH_PAYLOAD        (1 << 3)
 /**< Flag to indicate that the signature is not built-in */
 #define SIGMATCH_NOT_BUILT      (1 << 4)
+/** sigmatch may have options, so the parser should be ready to
+ *  deal with both cases */
+#define SIGMATCH_OPTIONAL_OPT   (1 << 5)
 
 /** Remember to add the options in SignatureIsIPOnly() at detect.c otherwise it wont be part of a signature group */