From: Victor Julien Date: Wed, 26 Feb 2014 05:28:30 +0000 (+0100) Subject: byte_extract/test/jump: fix coverity issues X-Git-Tag: suricata-2.0rc2~63 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3fa958b9a78fb5c0564c798ac95de0c1f9eb4771;p=thirdparty%2Fsuricata.git byte_extract/test/jump: fix coverity issues During keyword setup there was a path that in theory could lead to indexing an array with a negative int. Coverity 992695, 400605, 400604 --- diff --git a/src/detect-byte-extract.c b/src/detect-byte-extract.c index 948a996623..9eae71eb78 100644 --- a/src/detect-byte-extract.c +++ b/src/detect-byte-extract.c @@ -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; diff --git a/src/detect-bytejump.c b/src/detect-bytejump.c index 9549e8e4ca..c2e0da0c3d 100644 --- a/src/detect-bytejump.c +++ b/src/detect-bytejump.c @@ -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 { diff --git a/src/detect-bytetest.c b/src/detect-bytetest.c index 661bb310c9..25d731fb4d 100644 --- a/src/detect-bytetest.c +++ b/src/detect-bytetest.c @@ -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 {