]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
log: fix -Wshorten-64-to-32 warnings
authorPhilippe Antoine <pantoine@oisf.net>
Mon, 29 Jul 2024 19:50:36 +0000 (21:50 +0200)
committerVictor Julien <victor@inliniac.net>
Thu, 1 Aug 2024 05:05:15 +0000 (07:05 +0200)
Ticket: #6186

src/log-cf-common.c
src/log-httplog.c
src/log-pcap.c
src/log-tlslog.c
src/log-tlslog.h
src/util-print.c
src/util-print.h

index 077813501c32201eae76a328d1078a6c77e9df82..43fc9e3a9d6afcfe7f2778745d658797a9149692 100644 (file)
@@ -123,7 +123,7 @@ int LogCustomFormatParse(LogCustomFormat *cf, const char *format)
                 n = LOG_NODE_STRLEN-2;
                 np = NULL; /* End */
             }else{
-                n = np-p;
+                n = (uint32_t)(np - p);
             }
             strlcpy(node->data,p,n+1);
             p = np;
@@ -151,7 +151,7 @@ int LogCustomFormatParse(LogCustomFormat *cf, const char *format)
                 np = strchr(p, '}');
                 if (np != NULL && np-p > 1 && np-p < LOG_NODE_STRLEN-2) {
                     p++;
-                    n = np-p;
+                    n = (uint32_t)(np - p);
                     strlcpy(node->data, p, n+1);
                     p = np;
                 } else {
index 93b6e0da9179b7ad49422cf439dc5854e80bed20..ee561f5609ea0e3fd9bcb233e8db8d7d4ee94702 100644 (file)
@@ -130,7 +130,7 @@ static void LogHttpLogCustom(LogHttpLogThread *aft, htp_tx_t *tx, const SCTime_t
 {
     LogHttpFileCtx *httplog_ctx = aft->httplog_ctx;
     uint32_t i;
-    uint32_t datalen;
+    size_t datalen;
     char buf[128];
 
     uint8_t *cvalue = NULL;
@@ -251,9 +251,9 @@ static void LogHttpLogCustom(LogHttpLogThread *aft, htp_tx_t *tx, const SCTime_t
                 if (tx->request_headers != NULL) {
                     h_request_hdr = htp_table_get_c(tx->request_headers, "Cookie");
                     if (h_request_hdr != NULL) {
-                        cvalue_len = GetCookieValue((uint8_t *) bstr_ptr(h_request_hdr->value),
-                                    bstr_len(h_request_hdr->value), (char *) node->data,
-                                    &cvalue);
+                        cvalue_len = GetCookieValue((uint8_t *)bstr_ptr(h_request_hdr->value),
+                                (uint32_t)bstr_len(h_request_hdr->value), (char *)node->data,
+                                &cvalue);
                     }
                 }
                 if (cvalue_len > 0 && cvalue != NULL) {
index c0b6ef7d00f4f37e65efc4e020bb38c9dc9d8fd2..253560961dd0c28ae23c459b00501bb7018c9a98 100644 (file)
@@ -1466,7 +1466,7 @@ static OutputInitResult PcapLogInitCtx(ConfNode *conf)
             } else {
                 lvl = 0;
             }
-            comp->lz4f_prefs.compressionLevel = lvl;
+            comp->lz4f_prefs.compressionLevel = (int)lvl;
 
             /* Allocate resources for lz4. */
 
index db886f7b131606135287638d8d4089875a457f66..12e235c21ac09680a2d30d8f9ccbd3a05f31b8ec 100644 (file)
@@ -91,9 +91,8 @@ typedef struct LogTlsLogThread_ {
     MemBuffer *buffer;
 } LogTlsLogThread;
 
-int TLSGetIPInformations(const Packet *p, char* srcip, size_t srcip_len,
-                         Port* sp, char* dstip, size_t dstip_len, Port* dp,
-                         int ipproto)
+int TLSGetIPInformations(const Packet *p, char *srcip, socklen_t srcip_len, Port *sp, char *dstip,
+        socklen_t dstip_len, Port *dp, int ipproto)
 {
     if ((PKT_IS_TOSERVER(p))) {
         switch (ipproto) {
index fb01562842d4415addb000048090ae26081bc830..4a224ff156efc77eece0b3a49b8cc7a123bd33b7 100644 (file)
@@ -27,8 +27,7 @@
 
 void LogTlsLogRegister(void);
 
-int TLSGetIPInformations(const Packet *p, char* srcip, size_t srcip_len,
-                             Port* sp, char* dstip, size_t dstip_len,
-                             Port* dp, int ipproto);
+int TLSGetIPInformations(const Packet *p, char *srcip, socklen_t srcip_len, Port *sp, char *dstip,
+        socklen_t dstip_len, Port *dp, int ipproto);
 
 #endif /* SURICATA_LOG_TLSLOG_H */
index 65de27eb38992c5aa69704eee7b2cefb9b1a4701..16b66679f6808ab48d19f978898887ea31d3772c 100644 (file)
@@ -90,10 +90,9 @@ void PrintRawUriFp(FILE *fp, uint8_t *buf, uint32_t buflen)
     fprintf(fp, "%s", nbuf);
 }
 
-void PrintRawUriBuf(char *retbuf, uint32_t *offset, uint32_t retbuflen,
-                    uint8_t *buf, uint32_t buflen)
+void PrintRawUriBuf(char *retbuf, uint32_t *offset, uint32_t retbuflen, uint8_t *buf, size_t buflen)
 {
-    for (uint32_t u = 0; u < buflen; u++) {
+    for (size_t u = 0; u < buflen; u++) {
         if (isprint(buf[u]) && buf[u] != '\"') {
             if (buf[u] == '\\') {
                 PrintBufferData(retbuf, offset, retbuflen,
index e33de781997f9a0f6864c34a7a2990be641afde7..c9f19b4cdb2dc17309a3ef5d74e5618c3fadf2e6 100644 (file)
@@ -41,7 +41,7 @@
 
 void PrintBufferRawLineHex(char *, int *,int, const uint8_t *, uint32_t);
 void PrintRawUriFp(FILE *, uint8_t *, uint32_t);
-void PrintRawUriBuf(char *, uint32_t *, uint32_t, uint8_t *, uint32_t);
+void PrintRawUriBuf(char *, uint32_t *, uint32_t, uint8_t *, size_t);
 void PrintRawDataFp(FILE *, const uint8_t *, uint32_t);
 void PrintRawDataToBuffer(uint8_t *dst_buf, uint32_t *dst_buf_offset_ptr, uint32_t dst_buf_size,
                           const uint8_t *src_buf, uint32_t src_buf_len);