]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
output: fix integer warnings 7219/head
authorPhilippe Antoine <contact@catenacyber.fr>
Tue, 18 Jan 2022 09:56:48 +0000 (10:56 +0100)
committerPhilippe Antoine <contact@catenacyber.fr>
Fri, 8 Apr 2022 12:51:06 +0000 (14:51 +0200)
Ticket: 4516

src/output-json-dnp3.c
src/output-json-file.c
src/output-json-ftp.c
src/output-json-stats.c

index 082a37fcbc022b7d5e8f5809c2f7ded78825dce4..016499ddfcf56daa2a0b4c97ff84dfca5701ed75 100644 (file)
@@ -204,7 +204,7 @@ void JsonDNP3LogResponse(JsonBuilder *js, DNP3Transaction *dnp3tx)
     jb_close(js);
 
     jb_open_object(js, "iin");
-    JsonDNP3LogIin(js, dnp3tx->response_iin.iin1 << 8 | dnp3tx->response_iin.iin2);
+    JsonDNP3LogIin(js, (uint16_t)(dnp3tx->response_iin.iin1 << 8 | dnp3tx->response_iin.iin2));
     jb_close(js);
 }
 
index dabcaab58d6cd1686b452110359b87b59f8d6c52..cc6146813de60a761716b371393640b0d1a966d0 100644 (file)
@@ -202,7 +202,7 @@ JsonBuilder *JsonBuildFileInfoRecord(const Packet *p, const File *ff, const bool
  *  \brief Write meta data on a single line json record
  */
 static void FileWriteJsonRecord(JsonFileLogThread *aft, const Packet *p, const File *ff,
-        uint32_t dir, OutputJsonCtx *eve_ctx)
+        uint8_t dir, OutputJsonCtx *eve_ctx)
 {
     HttpXFFCfg *xff_cfg = aft->filelog_ctx->xff_cfg != NULL ?
         aft->filelog_ctx->xff_cfg : aft->filelog_ctx->parent_xff_cfg;;
index 3c27d95c8d29b91f535f5731caf275baf6cb78d0..eae7d9ebbcb7bd83cda0c3481ac18aefb87b47b8 100644 (file)
@@ -76,8 +76,13 @@ static void EveFTPLogCommand(Flow *f, FTPTransaction *tx, JsonBuilder *jb)
         TAILQ_FOREACH(response, &tx->response_list, next) {
             /* handle multiple lines within the response, \r\n delimited */
             uint8_t *where = response->str;
-            uint16_t length = response->len ? response->len -1 : 0;
+            uint16_t length = 0;
             uint16_t pos;
+            if (response->len > 0 && response->len <= UINT16_MAX) {
+                length = (uint16_t)response->len - 1;
+            } else if (response->len > UINT16_MAX) {
+                length = UINT16_MAX;
+            }
             while ((pos = JsonGetNextLineFromBuffer((const char *)where, length)) != UINT16_MAX) {
                 uint16_t offset = 0;
                 /* Try to find a completion code for this line */
index 07c4dc1c78a182507e7eae45781b299cc556a3f6..181bb54106c3965a87ec48cb1cc01457b8123e16 100644 (file)
@@ -64,7 +64,7 @@ typedef enum OutputEngineInfo_ {
 
 typedef struct OutputStatsCtx_ {
     LogFileCtx *file_ctx;
-    uint32_t flags; /** Store mode */
+    uint8_t flags; /** Store mode */
 } OutputStatsCtx;
 
 typedef struct JsonStatsLogThread_ {