]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
byte_extract/test/jump: fix coverity issues
authorVictor Julien <victor@inliniac.net>
Wed, 26 Feb 2014 05:28:30 +0000 (06:28 +0100)
committerVictor Julien <victor@inliniac.net>
Wed, 26 Feb 2014 06:11:11 +0000 (07:11 +0100)
During keyword setup there was a path that in theory could lead to
indexing an array with a negative int.

Coverity 992695, 400605, 400604

src/detect-byte-extract.c
src/detect-bytejump.c
src/detect-bytetest.c

index 948a996623a8e44c1d8591f8fc5af79d442f4c84..9eae71eb78b1e297f8b839214da74f6bfda42e28 100644 (file)
@@ -574,6 +574,8 @@ int DetectByteExtractSetup(DetectEngineCtx *de_ctx, Signature *s, char *arg)
                 sm_list = DETECT_SM_LIST_PMATCH;
             } else {
                 sm_list = SigMatchListSMBelongsTo(s, prev_pm);
+                if (sm_list < 0)
+                    goto error;
             }
         } else {
             sm_list = DETECT_SM_LIST_PMATCH;
index 9549e8e4ca77c2ffec4f9e7b74a2d1a0917dbba9..c2e0da0c3d8fedb1c215224b5bd9ab6ed2a9b33f 100644 (file)
@@ -568,6 +568,8 @@ int DetectBytejumpSetup(DetectEngineCtx *de_ctx, Signature *s, char *optstr)
                 sm_list = DETECT_SM_LIST_PMATCH;
             } else {
                 sm_list = SigMatchListSMBelongsTo(s, prev_pm);
+                if (sm_list < 0)
+                    goto error;
             }
         } else {
             sm_list = DETECT_SM_LIST_PMATCH;
@@ -671,6 +673,8 @@ int DetectBytejumpSetup(DetectEngineCtx *de_ctx, Signature *s, char *optstr)
             sm_list = DETECT_SM_LIST_PMATCH;
         } else {
             sm_list = SigMatchListSMBelongsTo(s, prev_pm);
+            if (sm_list < 0)
+                goto error;
         }
 
     } else {
index 661bb310c9cfd96b93abd775f411e34ca644712a..25d731fb4dc19c8a9e72a1acbc967cd241f2b427 100644 (file)
@@ -489,6 +489,8 @@ int DetectBytetestSetup(DetectEngineCtx *de_ctx, Signature *s, char *optstr)
                 sm_list = DETECT_SM_LIST_PMATCH;
             } else {
                 sm_list = SigMatchListSMBelongsTo(s, prev_pm);
+                if (sm_list < 0)
+                    goto error;
             }
         } else {
             sm_list = DETECT_SM_LIST_PMATCH;
@@ -592,6 +594,8 @@ int DetectBytetestSetup(DetectEngineCtx *de_ctx, Signature *s, char *optstr)
             sm_list = DETECT_SM_LIST_PMATCH;
         } else {
             sm_list = SigMatchListSMBelongsTo(s, prev_pm);
+            if (sm_list < 0)
+                goto error;
         }
 
     } else {