]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
enip: fix int warnings
authorPhilippe Antoine <contact@catenacyber.fr>
Mon, 22 Nov 2021 08:42:40 +0000 (09:42 +0100)
committerVictor Julien <vjulien@oisf.net>
Wed, 24 Nov 2021 07:07:31 +0000 (08:07 +0100)
There seems to fix a real bug when an ENIP connection
has more than 65k transactions

src/app-layer-enip-common.h
src/app-layer-enip.c

index 2eaa3a035ea5662be642bacd1889ca57057bcc1d..d8b5a0a7e1cbe4c30621bb5684a049892fe7c3c5 100644 (file)
@@ -120,8 +120,8 @@ typedef struct ENIPEncapAddresItem_
 {
     uint16_t type;
     uint16_t length;
-    uint16_t conn_id;
-    uint16_t sequence_num;
+    uint32_t conn_id;
+    uint32_t sequence_num;
 } ENIPEncapAddresItem;
 
 /**
@@ -182,7 +182,7 @@ typedef struct CIPServiceEntry_
         } request;
         struct
         {
-            uint8_t status;
+            uint16_t status;
         } response;
     };
 
@@ -195,7 +195,7 @@ typedef struct CIPServiceEntry_
 typedef struct ENIPTransaction_
 {
     struct ENIPState_ *enip;
-    uint16_t tx_num;                            /**< internal: id */
+    uint64_t tx_num;                            /**< internal: id */
     uint16_t tx_id;                             /**< transaction id */
     uint16_t service_count;
 
index e7a9e9d3eddb43dd01499bb4e7f00867b0f19b5d..cac76412f6acc9f984ce1dbed8c6573936af867a 100644 (file)
@@ -93,7 +93,7 @@ static void *ENIPGetTx(void *alstate, uint64_t tx_id)
 
 static uint64_t ENIPGetTxCnt(void *alstate)
 {
-    return ((uint64_t) ((ENIPState *) alstate)->transaction_max);
+    return ((ENIPState *)alstate)->transaction_max;
 }
 
 static AppLayerDecoderEvents *ENIPGetEvents(void *tx)