]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
app-layer: fix integer warnings
authorPhilippe Antoine <contact@catenacyber.fr>
Tue, 18 Jan 2022 10:19:21 +0000 (11:19 +0100)
committerVictor Julien <vjulien@oisf.net>
Thu, 14 Apr 2022 20:44:18 +0000 (22:44 +0200)
Ticket: 4516

src/app-layer-detect-proto.c
src/app-layer-frames.c
src/app-layer-parser.c
src/app-layer.c
src/detect-engine-mpm.c
src/detect-engine-mpm.h

index 5b43b0a97cba659b29e9c9fe6f85501c4f48c4e4..0ee69117d99af7dec3407cb095cd54fa846f3690 100644 (file)
@@ -1845,7 +1845,7 @@ int AppLayerProtoDetectSetup(void)
     memset(&alpd_ctx, 0, sizeof(alpd_ctx));
 
     uint16_t spm_matcher = SinglePatternMatchDefaultMatcher();
-    uint16_t mpm_matcher = PatternMatchDefaultMatcher();
+    uint8_t mpm_matcher = PatternMatchDefaultMatcher();
 
     alpd_ctx.spm_global_thread_ctx = SpmInitGlobalThreadCtx(spm_matcher);
     if (alpd_ctx.spm_global_thread_ctx == NULL) {
index cadbfafafc79c9b2e42c0f5fdb5707c9b7564b56..71f6247e5c6d33b73ef926e0283dc24e0572773a 100644 (file)
@@ -70,7 +70,7 @@ Frame *FrameGetByIndex(Frames *frames, const uint32_t idx)
         FrameDebug("get_by_idx(s)", frames, frame);
         return frame;
     } else {
-        const uint16_t o = idx - FRAMES_STATIC_CNT;
+        const uint32_t o = idx - FRAMES_STATIC_CNT;
         Frame *frame = &frames->dframes[o];
         FrameDebug("get_by_idx(d)", frames, frame);
         return frame;
index 3b04aa94c5bb999a934d684768511c651e303dbb..97172b704666e714991fabd84a33e9662463f401 100644 (file)
@@ -1256,7 +1256,7 @@ int AppLayerParserParse(ThreadVars *tv, AppLayerParserThreadCtx *alp_tctx, Flow
     void *alstate = NULL;
     uint64_t p_tx_cnt = 0;
     uint32_t consumed = input_len;
-    const int direction = (flags & STREAM_TOSERVER) ? 0 : 1;
+    const uint8_t direction = (flags & STREAM_TOSERVER) ? 0 : 1;
 
     /* we don't have the parser registered for this protocol */
     if (p->StateAlloc == NULL)
index c7651f571adab942ba7b0aa9d7ee9b4585839643..01be13c65d4a62708d91fbcd1acf4ebe01562f35 100644 (file)
@@ -345,7 +345,7 @@ static int TCPProtoDetect(ThreadVars *tv,
 {
     AppProto *alproto;
     AppProto *alproto_otherdir;
-    int direction = (flags & STREAM_TOSERVER) ? 0 : 1;
+    uint8_t direction = (flags & STREAM_TOSERVER) ? 0 : 1;
 
     if (flags & STREAM_TOSERVER) {
         alproto = &f->alproto_ts;
@@ -651,7 +651,7 @@ int AppLayerHandleTCPData(ThreadVars *tv, TcpReassemblyThreadCtx *ra_ctx,
         goto end;
     }
 
-    const int direction = (flags & STREAM_TOSERVER) ? 0 : 1;
+    const uint8_t direction = (flags & STREAM_TOSERVER) ? 0 : 1;
 
     if (flags & STREAM_TOSERVER) {
         alproto = f->alproto_ts;
index afff06d9604e78f6420e86d2bca1a4d6adc869c1..2d55e709ed8a7a6a7a0bdbf75c0f7e034d8fca51 100644 (file)
@@ -853,10 +853,10 @@ int SignatureHasStreamContent(const Signature *s)
  *
  *  \retval mpm algo value
  */
-uint16_t PatternMatchDefaultMatcher(void)
+uint8_t PatternMatchDefaultMatcher(void)
 {
     const char *mpm_algo;
-    uint16_t mpm_algo_val = mpm_default_matcher;
+    uint8_t mpm_algo_val = mpm_default_matcher;
 
     /* Get the mpm algo defined in config file by the user */
     if ((ConfGet("mpm-algo", &mpm_algo)) == 1) {
index a9149be8e1dad45af7fb723c69e6be6bbbfd5a68..2aa2e1a666643de11d7bd76ebad9d1bfb4a8c5dd 100644 (file)
@@ -43,7 +43,7 @@ int DetectMpmPrepareBuiltinMpms(DetectEngineCtx *de_ctx);
 
 uint32_t PatternStrength(uint8_t *, uint16_t);
 
-uint16_t PatternMatchDefaultMatcher(void);
+uint8_t PatternMatchDefaultMatcher(void);
 uint32_t DnsQueryPatternSearch(DetectEngineThreadCtx *det_ctx, uint8_t *buffer, uint32_t buffer_len, uint8_t flags);
 
 void PatternMatchPrepare(MpmCtx *, uint16_t);