]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
warnings: fixes integer sizes in format strings
authorPhilippe Antoine <contact@catenacyber.fr>
Tue, 4 Jun 2019 09:27:04 +0000 (11:27 +0200)
committerVictor Julien <victor@inliniac.net>
Sat, 8 Jun 2019 19:16:35 +0000 (21:16 +0200)
Fixes #3009

12 files changed:
src/decode-icmpv4.c
src/decode-icmpv6.c
src/decode-ipv4.c
src/decode-ipv6.c
src/decode-raw.c
src/detect-engine-alert.c
src/detect-engine-iponly.c
src/detect-flowint.c
src/detect-tls-version.c
src/detect-ttl.c
src/stream-tcp-private.h
src/util-cpu.c

index 00bc27630845ff440258ab7a17445211536a0791..68167067613eecf96e7e5a464373e44b6d8256fa 100644 (file)
@@ -85,7 +85,7 @@ static int DecodePartialIPV4(Packet* p, uint8_t* partial_packet, uint16_t len)
                 p->icmpv4vars.emb_ip4_proto = IPPROTO_TCP;
 
                 SCLogDebug("DecodePartialIPV4: ICMPV4->IPV4->TCP header sport: "
-                           "%"PRIu8" dport %"PRIu8"", p->icmpv4vars.emb_sport,
+                           "%"PRIu16" dport %"PRIu16"", p->icmpv4vars.emb_sport,
                             p->icmpv4vars.emb_dport);
             } else if (len >= IPV4_HEADER_LEN + 4) {
                 /* only access th_sport and th_dport */
@@ -96,7 +96,7 @@ static int DecodePartialIPV4(Packet* p, uint8_t* partial_packet, uint16_t len)
                 p->icmpv4vars.emb_dport = SCNtohs(emb_tcph->th_dport);
                 p->icmpv4vars.emb_ip4_proto = IPPROTO_TCP;
                 SCLogDebug("DecodePartialIPV4: ICMPV4->IPV4->TCP partial header sport: "
-                           "%"PRIu8" dport %"PRIu8"", p->icmpv4vars.emb_sport,
+                           "%"PRIu16" dport %"PRIu16"", p->icmpv4vars.emb_sport,
                             p->icmpv4vars.emb_dport);
             } else {
                 SCLogDebug("DecodePartialIPV4: Warning, ICMPV4->IPV4->TCP "
@@ -114,7 +114,7 @@ static int DecodePartialIPV4(Packet* p, uint8_t* partial_packet, uint16_t len)
                 p->icmpv4vars.emb_ip4_proto = IPPROTO_UDP;
 
                 SCLogDebug("DecodePartialIPV4: ICMPV4->IPV4->UDP header sport: "
-                           "%"PRIu8" dport %"PRIu8"", p->icmpv4vars.emb_sport,
+                           "%"PRIu16" dport %"PRIu16"", p->icmpv4vars.emb_sport,
                             p->icmpv4vars.emb_dport);
             } else {
                 SCLogDebug("DecodePartialIPV4: Warning, ICMPV4->IPV4->UDP "
index a6c713eb3090a9e45361659a4a47d70290dc1628..59e0afdc1a67c2ed809f837c08838f74f6541c86 100644 (file)
@@ -101,7 +101,7 @@ static void DecodePartialIPV6(Packet *p, uint8_t *partial_packet, uint16_t len )
                 p->icmpv6vars.emb_dport = p->icmpv6vars.emb_tcph->th_dport;
 
                 SCLogDebug("ICMPV6->IPV6->TCP header sport: "
-                           "%"PRIu8" dport %"PRIu8"", p->icmpv6vars.emb_sport,
+                           "%"PRIu16" dport %"PRIu16"", p->icmpv6vars.emb_sport,
                             p->icmpv6vars.emb_dport);
             } else {
                 SCLogDebug("Warning, ICMPV6->IPV6->TCP "
@@ -118,7 +118,7 @@ static void DecodePartialIPV6(Packet *p, uint8_t *partial_packet, uint16_t len )
                 p->icmpv6vars.emb_dport = p->icmpv6vars.emb_udph->uh_dport;
 
                 SCLogDebug("ICMPV6->IPV6->UDP header sport: "
-                           "%"PRIu8" dport %"PRIu8"", p->icmpv6vars.emb_sport,
+                           "%"PRIu16" dport %"PRIu16"", p->icmpv6vars.emb_sport,
                             p->icmpv6vars.emb_dport);
             } else {
                 SCLogDebug("Warning, ICMPV6->IPV6->UDP "
index 0d34174568547705da56fd6e8b0da23ddf329054..53fcc9827b02a107a08f592a86f621ec1b733d10 100644 (file)
@@ -329,12 +329,12 @@ static void DecodeIPV4Options(Packet *p, uint8_t *pkt, uint16_t len, IPV4Options
         /* single byte options */
         if (*pkt == IPV4_OPT_EOL) {
             /** \todo What if more data exist after EOL (possible covert channel or data leakage)? */
-            SCLogDebug("IPV4OPT %" PRIu16 " len 1 @ %" PRIu16 "/%" PRIu16 "",
+            SCLogDebug("IPV4OPT %" PRIu8 " len 1 @ %d/%d",
                    *pkt, (len - plen), (len - 1));
             p->ip4vars.opts_set |= IPV4_OPT_FLAG_EOL;
             break;
         } else if (*pkt == IPV4_OPT_NOP) {
-            SCLogDebug("IPV4OPT %" PRIu16 " len 1 @ %" PRIu16 "/%" PRIu16 "",
+            SCLogDebug("IPV4OPT %" PRIu8 " len 1 @ %d/%d",
                    *pkt, (len - plen), (len - 1));
             pkt++;
             plen--;
@@ -492,7 +492,7 @@ static int DecodeIPV4Packet(Packet *p, uint8_t *pkt, uint16_t len)
     }
 
     if (unlikely(IP_GET_RAW_VER(pkt) != 4)) {
-        SCLogDebug("wrong ip version %" PRIu8 "",IP_GET_RAW_VER(pkt));
+        SCLogDebug("wrong ip version %d",IP_GET_RAW_VER(pkt));
         ENGINE_SET_INVALID_EVENT(p, IPV4_WRONG_IP_VER);
         return -1;
     }
index 9ddf7b28c7b17fc99c9d1233c08c9e0b41e0b5f3..ce97b501ffbc7545e5ba8d5d56699cf31f713001 100644 (file)
@@ -201,7 +201,7 @@ DecodeIPV6ExtHdrs(ThreadVars *tv, DecodeThreadVars *dtv, Packet *p, uint8_t *pkt
                 IPV6_SET_L4PROTO(p,nh);
                 hdrextlen = 8 + (*(pkt+1) * 8);  /* 8 bytes + length in 8 octet units */
 
-                SCLogDebug("hdrextlen %"PRIu8, hdrextlen);
+                SCLogDebug("hdrextlen %"PRIu16, hdrextlen);
 
                 if (hdrextlen > plen) {
                     ENGINE_SET_INVALID_EVENT(p, IPV6_TRUNC_EXTHDR);
@@ -494,7 +494,7 @@ DecodeIPV6ExtHdrs(ThreadVars *tv, DecodeThreadVars *dtv, Packet *p, uint8_t *pkt
                 if (*(pkt+1) > 0)
                     hdrextlen += ((*(pkt+1) - 1) * 4);
 
-                SCLogDebug("hdrextlen %"PRIu8, hdrextlen);
+                SCLogDebug("hdrextlen %"PRIu16, hdrextlen);
 
                 if (hdrextlen > plen) {
                     ENGINE_SET_INVALID_EVENT(p, IPV6_TRUNC_EXTHDR);
@@ -562,7 +562,7 @@ static int DecodeIPV6Packet (ThreadVars *tv, DecodeThreadVars *dtv, Packet *p, u
     }
 
     if (unlikely(IP_GET_RAW_VER(pkt) != 6)) {
-        SCLogDebug("wrong ip version %" PRIu8 "",IP_GET_RAW_VER(pkt));
+        SCLogDebug("wrong ip version %d",IP_GET_RAW_VER(pkt));
         ENGINE_SET_INVALID_EVENT(p, IPV6_WRONG_IP_VER);
         return -1;
     }
index f5ad077044ddb03899ff21c8ffd5ef8821f40c06..864c39d208a491a351afe9b868bc2aa7cbf058b8 100644 (file)
@@ -68,7 +68,7 @@ int DecodeRaw(ThreadVars *tv, DecodeThreadVars *dtv, Packet *p, uint8_t *pkt, ui
         SCLogDebug("IPV6 Packet");
         DecodeIPV6(tv, dtv, p, GET_PKT_DATA(p), GET_PKT_LEN(p), pq);
     } else {
-        SCLogDebug("Unknown ip version %" PRIu8 "", IP_GET_RAW_VER(pkt));
+        SCLogDebug("Unknown ip version %d", IP_GET_RAW_VER(pkt));
         ENGINE_SET_EVENT(p,IPRAW_INVALID_IPV);
     }
     return TM_ECODE_OK;
index 4a44888bab324be4aa94d70850573f74e9d98a28..d2401b57af7ed645d1f90f8277385f4797cd6770 100644 (file)
@@ -241,7 +241,7 @@ void PacketAlertFinalize(DetectEngineCtx *de_ctx, DetectEngineThreadCtx *det_ctx
     int i = 0;
 
     while (i < p->alerts.cnt) {
-        SCLogDebug("Sig->num: %"PRIu16, p->alerts.alerts[i].num);
+        SCLogDebug("Sig->num: %"PRIu32, p->alerts.alerts[i].num);
         const Signature *s = de_ctx->sig_array[p->alerts.alerts[i].num];
 
         int res = PacketAlertHandle(de_ctx, det_ctx, s, p, &p->alerts.alerts[i]);
index 84ed5e95b6cc4c0ab14cf503c2945e719dd59b32..0b2870dd32441326b012520a54fc62e4a8a1490f 100644 (file)
@@ -1070,7 +1070,7 @@ void IPOnlyMatchPacket(ThreadVars *tv,
                         continue;
                     }
 
-                    SCLogDebug("Signum %"PRIu16" match (sid: %"PRIu16", msg: %s)",
+                    SCLogDebug("Signum %"PRIu32" match (sid: %"PRIu32", msg: %s)",
                                u * 8 + i, s->id, s->msg);
 
                     if (s->sm_arrays[DETECT_SM_LIST_POSTMATCH] != NULL) {
@@ -1325,8 +1325,8 @@ void IPOnlyPrepare(DetectEngineCtx *de_ctx)
         if (dst->family == AF_INET) {
 
             SCLogDebug("To IPv4");
-            SCLogDebug("Item has netmask %"PRIu16" negated: %s; IP: %s; signum:"
-                       " %"PRIu16"", dst->netmask, (dst->negated)?"yes":"no",
+            SCLogDebug("Item has netmask %"PRIu8" negated: %s; IP: %s; signum:"
+                       " %"PRIu32"", dst->netmask, (dst->negated)?"yes":"no",
                        inet_ntoa(*(struct in_addr*)&dst->ip[0]), dst->signum);
 
             void *user_data = NULL;
index ce5993e524bf8dcf6bbd8bccc8cdecb0ac5ee63a..59fb0d8faff5a2ee1e7b9a96f07e0f66484d4cc2 100644 (file)
@@ -119,7 +119,7 @@ int DetectFlowintMatch(ThreadVars *t, DetectEngineThreadCtx *det_ctx,
         targetval = sfd->target.value;
     }
 
-    SCLogDebug("Our var %s is at idx: %"PRIu16"", sfd->name, sfd->idx);
+    SCLogDebug("Our var %s is at idx: %"PRIu32"", sfd->name, sfd->idx);
 
     if (sfd->modifier == FLOWINT_MODIFIER_SET) {
         FlowVarAddIntNoLock(p->flow, sfd->idx, targetval);
index babd70f7d4985cd8c481665e76a3cc9fe0908736..da038d6a024d96f88f4eed2553dfcb4788607531 100644 (file)
@@ -212,7 +212,7 @@ static DetectTlsVersionData *DetectTlsVersionParse (const char *str)
 
         SCFree(orig);
 
-        SCLogDebug("will look for tls %"PRIu8"", tls->ver);
+        SCLogDebug("will look for tls %"PRIu16"", tls->ver);
     }
 
     return tls;
index bf0fac7f2de087db2854db382c63076b7aaf805a..aee5122d3a49a1ee3af5ca95eed167bfc6c67052 100644 (file)
@@ -183,7 +183,7 @@ static DetectTtlData *DetectTtlParse (const char *ttlstr)
                 mode = DETECT_TTL_LT;
                 ttl1 = atoi(arg3);
 
-                SCLogDebug("ttl is %"PRIu8"",ttl1);
+                SCLogDebug("ttl is %d",ttl1);
                 if (strlen(arg1) > 0)
                     return NULL;
 
@@ -195,7 +195,7 @@ static DetectTtlData *DetectTtlParse (const char *ttlstr)
                 mode = DETECT_TTL_GT;
                 ttl1 = atoi(arg3);
 
-                SCLogDebug("ttl is %"PRIu8"",ttl1);
+                SCLogDebug("ttl is %d",ttl1);
                 if (strlen(arg1) > 0)
                     return NULL;
 
@@ -208,7 +208,7 @@ static DetectTtlData *DetectTtlParse (const char *ttlstr)
                 ttl1 = atoi(arg1);
                 ttl2 = atoi(arg3);
 
-                SCLogDebug("ttl is %"PRIu8" to %"PRIu8"",ttl1, ttl2);
+                SCLogDebug("ttl is %d to %d",ttl1, ttl2);
                 if (ttl1 >= ttl2) {
                     SCLogError(SC_ERR_INVALID_SIGNATURE, "invalid ttl range");
                     return NULL;
index 899dafa5dd6427f849f5c77bc8e490ceb08fe36a..2db9e17dcba2ce89f82f4f27dc89d0df2c0ceafb 100644 (file)
@@ -245,10 +245,10 @@ enum
 
 #define StreamTcpSetEvent(p, e) {                                           \
     if ((p)->flags & PKT_STREAM_NO_EVENTS) {                                \
-        SCLogDebug("not setting event %"PRIu8" on pkt %p (%"PRIu64"), "     \
+        SCLogDebug("not setting event %d on pkt %p (%"PRIu64"), "     \
                    "stream in known bad condition", (e), p, (p)->pcap_cnt); \
     } else {                                                                \
-        SCLogDebug("setting event %"PRIu8" on pkt %p (%"PRIu64")",          \
+        SCLogDebug("setting event %d on pkt %p (%"PRIu64")",          \
                     (e), p, (p)->pcap_cnt);                                 \
         ENGINE_SET_EVENT((p), (e));                                         \
     }                                                                       \
index aa457028ef34d99bc71adcfd7ef4e3f1d5f2a9f7..f21a338879547e444b25c31fe2c805f5862195ce 100644 (file)
@@ -67,7 +67,7 @@ uint16_t UtilCpuGetNumProcessorsConfigured(void)
     }
 
     if (nprocs > UINT16_MAX) {
-        SCLogDebug("It seems that there are more than %"PRIu16" CPUs "
+        SCLogDebug("It seems that there are more than %d CPUs "
                    "configured on this system. You can modify util-cpu.{c,h} "
                    "to use uint32_t to support it", UINT16_MAX);
         return UINT16_MAX;
@@ -108,7 +108,7 @@ uint16_t UtilCpuGetNumProcessorsOnline(void)
     }
 
     if (nprocs > UINT16_MAX) {
-        SCLogDebug("It seems that there are more than %"PRIu16" CPUs online. "
+        SCLogDebug("It seems that there are more than %d CPUs online. "
                    "You can modify util-cpu.{c,h} to use uint32_t to "
                    "support it", UINT16_MAX);
         return UINT16_MAX;