]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
filestore: fix parsing bug 1149/head 1150/head
authorVictor Julien <victor@inliniac.net>
Tue, 30 Sep 2014 07:56:41 +0000 (09:56 +0200)
committerVictor Julien <victor@inliniac.net>
Fri, 3 Oct 2014 14:36:24 +0000 (16:36 +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 bbbaa964b2bfe03f799a4f4fe1f106449bc89159..cd847fc4dd9cb04f109b0250b0d2f032f5f39fd3 100644 (file)
@@ -76,7 +76,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 7d940ae8e61c5831326b1c33fefa935767ad2f35..0b147fef8ebae2496abf212adfb494aabd35519a 100644 (file)
@@ -545,7 +545,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 4ad199ac26a62b06c0282d2a6d4ba8e7c54af328..1839252ab3c1534c95767bdd08fd34a2cf73cd14 100644 (file)
@@ -1021,6 +1021,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 */