]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
Fix minor format string issues
authorVictor Julien <victor@inliniac.net>
Fri, 21 Aug 2015 07:48:42 +0000 (09:48 +0200)
committerVictor Julien <victor@inliniac.net>
Mon, 31 Aug 2015 14:12:09 +0000 (16:12 +0200)
src/app-layer-detect-proto.c
src/decode-tcp.h
src/detect-engine-iponly.c
src/detect-engine-siggroup.c
src/log-droplog.c
src/runmode-erf-file.c
src/runmode-pcap-file.c
src/tm-threads.c
src/util-byte.c
src/util-decode-asn1.c
src/util-runmodes.c

index 9545dffac7d5fada369d3c4217f294713fa28da0..ed029e5e6b8b2711f6c348a1a9d9a035a64d3fe2 100644 (file)
@@ -645,7 +645,7 @@ void AppLayerProtoDetectPrintProbingParsers(AppLayerProtoDetectProbingParser *pp
         else if (pp->ipproto == IPPROTO_UDP)
             printf("IPProto: UDP\n");
         else
-            printf("IPProto: %"PRIu16"\n", pp->ipproto);
+            printf("IPProto: %"PRIu8"\n", pp->ipproto);
 
         pp_port = pp->port;
         for ( ; pp_port != NULL; pp_port = pp_port->next) {
@@ -934,7 +934,7 @@ static void AppLayerProtoDetectInsertNewProbingParser(AppLayerProtoDetectProbing
     while (curr_pe != NULL) {
         if (curr_pe->alproto == alproto) {
             SCLogError(SC_ERR_ALPARSER, "Duplicate pp registered - "
-                       "ipproto - %"PRIu16" Port - %"PRIu16" "
+                       "ipproto - %"PRIu8" Port - %"PRIu16" "
                        "App Protocol - NULL, App Protocol(ID) - "
                        "%"PRIu16" min_depth - %"PRIu16" "
                        "max_dept - %"PRIu16".",
index 152d5103f42f2d66b6b8ac1702c5ad45676d35cd..29c02dfb2feaf2d3a90f2051cc7b312e4c934527 100644 (file)
@@ -66,7 +66,7 @@
 #define TCP_OPTS_CNT                         tcpvars.tcp_opt_cnt
 
 #define TCP_GET_RAW_OFFSET(tcph)             (((tcph)->th_offx2 & 0xf0) >> 4)
-#define TCP_GET_RAW_X2(tcph)                 ((tcph)->th_offx2 & 0x0f)
+#define TCP_GET_RAW_X2(tcph)                 (unsigned char)((tcph)->th_offx2 & 0x0f)
 #define TCP_GET_RAW_SRC_PORT(tcph)           ntohs((tcph)->th_sport)
 #define TCP_GET_RAW_DST_PORT(tcph)           ntohs((tcph)->th_dport)
 
index bfbbb0f4b33a07648af965bc13ceca5010ff832b..06983fc0153be441b8494a1ce00eaa67d4b8cc60 100644 (file)
@@ -484,7 +484,7 @@ static void SigNumArrayPrint(void *tmp)
 
         for (; i < 8; i++) {
             if (bitarray & 0x01)
-                printf(", %"PRIu16"", u * 8 + i);
+                printf(", %"PRIu32"", u * 8 + i);
             else
                 printf(", ");
 
index a7ecbafd9abdaa828d602bcce3711e99d92087bb..02602d908e391ef24ca89a1274502a1d6d25cf67 100644 (file)
@@ -1225,7 +1225,7 @@ void SigGroupHeadPrintSigs(DetectEngineCtx *de_ctx, SigGroupHead *sgh)
     for (u = 0; u < (sgh->init->sig_size * 8); u++) {
         if (sgh->init->sig_array[u / 8] & (1 << (u % 8))) {
             SCLogDebug("%" PRIu32, u);
-            printf("s->num %"PRIu16" ", u);
+            printf("s->num %"PRIu32" ", u);
         }
     }
 
index 1ee2d999f7baeea73a7482a0c857bb0e927a2cad..6eafd9d5ef93b446fe3cb1a24efae8bb9da4a37c 100644 (file)
@@ -244,11 +244,11 @@ static int LogDropLogNetFilter (ThreadVars *tv, const Packet *p, void *data)
             break;
         case IPPROTO_ICMP:
             if (PKT_IS_ICMPV4(p)) {
-                fprintf(dlt->file_ctx->fp, " TYPE=%"PRIu16" CODE=%"PRIu16""
+                fprintf(dlt->file_ctx->fp, " TYPE=%"PRIu8" CODE=%"PRIu8""
                         " ID=%"PRIu16" SEQ=%"PRIu16"", ICMPV4_GET_TYPE(p),
                         ICMPV4_GET_CODE(p), ICMPV4_GET_ID(p), ICMPV4_GET_SEQ(p));
             } else if(PKT_IS_ICMPV6(p)) {
-                fprintf(dlt->file_ctx->fp, " TYPE=%"PRIu16" CODE=%"PRIu16""
+                fprintf(dlt->file_ctx->fp, " TYPE=%"PRIu8" CODE=%"PRIu8""
                         " ID=%"PRIu16" SEQ=%"PRIu16"", ICMPV6_GET_TYPE(p),
                         ICMPV6_GET_CODE(p), ICMPV6_GET_ID(p), ICMPV6_GET_SEQ(p));
             }
index ef7d2e09ec9c7293c34a7698de8a0b404d0fad5b..19dbb683dfe00975e4343cf1146b7172d2851b78 100644 (file)
@@ -202,8 +202,8 @@ int RunModeErfFileAutoFp(void)
     }
 
     for (thread = 0; thread < thread_max; thread++) {
-        snprintf(tname, sizeof(tname), "Detect%"PRIu16, thread+1);
-        snprintf(qname, sizeof(qname), "pickup%"PRIu16, thread+1);
+        snprintf(tname, sizeof(tname), "Detect%d", thread+1);
+        snprintf(qname, sizeof(qname), "pickup%d", thread+1);
 
         SCLogDebug("tname %s, qname %s", tname, qname);
 
index d337cb9711a72f68fdd1be58a056aea781b42228..fab14639b342f68a4b9a33026bd077cb61292c04 100644 (file)
@@ -217,8 +217,8 @@ int RunModeFilePcapAutoFp(void)
     }
 
     for (thread = 0; thread < thread_max; thread++) {
-        snprintf(tname, sizeof(tname), "Detect%"PRIu16, thread+1);
-        snprintf(qname, sizeof(qname), "pickup%"PRIu16, thread+1);
+        snprintf(tname, sizeof(tname), "Detect%d", thread+1);
+        snprintf(qname, sizeof(qname), "pickup%d", thread+1);
 
         SCLogDebug("tname %s, qname %s", tname, qname);
 
index f0f8a3cf0a925252cb70a7da98b0c6bd471cad7c..c6828b4071ad1bf2d14158b4ebd4721e92644085 100644 (file)
@@ -991,7 +991,7 @@ TmEcode TmThreadSetupOptions(ThreadVars *tv)
                 tv->thread_priority = taf->prio;
             }
             SCLogInfo("Setting prio %d for \"%s\" Module to cpu/core "
-                      "%"PRIu16", thread id %lu", tv->thread_priority,
+                      "%d, thread id %lu", tv->thread_priority,
                       tv->name, cpu, SCGetThreadIdLong());
         } else {
             SetCPUAffinitySet(&taf->cpu_set);
index 6f0cd132314c7311cdf5d57ca38b76bb65fefc99..1d8e088a6a99d8bee65e5eeecc597b6400e925f0 100644 (file)
@@ -207,7 +207,7 @@ int ByteExtractStringUint32(uint32_t *res, int base, uint16_t len, const char *s
 
     if ((uint64_t)(*res) != i64) {
         SCLogError(SC_ERR_NUMERIC_VALUE_ERANGE, "Numeric value out of range "
-                   "(%" PRIu64 " > %" PRIu32 ")", i64, UINT_MAX);
+                   "(%" PRIu64 " > %" PRIuMAX ")", i64, (uintmax_t)UINT_MAX);
         return -1;
     }
 
@@ -228,7 +228,7 @@ int ByteExtractStringUint16(uint16_t *res, int base, uint16_t len, const char *s
 
     if ((uint64_t)(*res) != i64) {
         SCLogError(SC_ERR_NUMERIC_VALUE_ERANGE, "Numeric value out of range "
-                   "(%" PRIu64 " > %" PRIu16 ")", i64, USHRT_MAX);
+                   "(%" PRIu64 " > %" PRIuMAX ")", i64, (uintmax_t)USHRT_MAX);
         return -1;
     }
 
@@ -249,7 +249,7 @@ int ByteExtractStringUint8(uint8_t *res, int base, uint16_t len, const char *str
 
     if ((uint64_t)(*res) != i64) {
         SCLogError(SC_ERR_NUMERIC_VALUE_ERANGE, "Numeric value out of range "
-                   "(%" PRIu64 " > %" PRIu8 ")", i64, UCHAR_MAX);
+                   "(%" PRIu64 " > %" PRIuMAX ")", i64, (uintmax_t)UCHAR_MAX);
         return -1;
     }
 
@@ -326,7 +326,7 @@ int ByteExtractStringInt32(int32_t *res, int base, uint16_t len, const char *str
 
     if ((int64_t)(*res) != i64) {
         SCLogError(SC_ERR_NUMERIC_VALUE_ERANGE, "Numeric value out of range "
-                   "(%" PRIi64 " > %" PRIi32 ")\n", i64, INT_MAX);
+                   "(%" PRIi64 " > %" PRIiMAX ")\n", i64, (intmax_t)INT_MAX);
         return -1;
     }
 
@@ -347,7 +347,7 @@ int ByteExtractStringInt16(int16_t *res, int base, uint16_t len, const char *str
 
     if ((int64_t)(*res) != i64) {
         SCLogError(SC_ERR_NUMERIC_VALUE_ERANGE, "Numeric value out of range "
-                   "(%" PRIi64 " > %" PRIi16 ")\n", i64, SHRT_MAX);
+                   "(%" PRIi64 " > %" PRIiMAX ")\n", i64, (intmax_t)SHRT_MAX);
         return -1;
     }
 
@@ -368,7 +368,7 @@ int ByteExtractStringInt8(int8_t *res, int base, uint16_t len, const char *str)
 
     if ((int64_t)(*res) != i64) {
         SCLogError(SC_ERR_NUMERIC_VALUE_ERANGE, "Numeric value out of range "
-                   "(%" PRIi64 " > %" PRIi8 ")\n", i64, CHAR_MAX);
+                   "(%" PRIi64 " > %" PRIiMAX ")\n", i64, (intmax_t)CHAR_MAX);
         return -1;
     }
 
index 6766af66c572f7e2dc3a00fc70be506903046540..3372b517cec46f04052725778ff706b220400aef 100644 (file)
@@ -319,7 +319,7 @@ void SCPrintByteBin(uint8_t byte)
 {
     uint8_t i = 0;
     for (i = 8; i > 0; i--) {
-        printf("%"PRIu8, ((byte >> (i - 1)) & 0x01));
+        printf("%"PRIu8, (uint8_t)((byte >> (i - 1)) & 0x01));
         if (i == 5)
             printf(" ");
     }
index 5e89f7b28dde40112bffccd5d17f608a8711a073..c9b61e6a2e55b10b3bcf6f73c72e9b0e0057dc5e 100644 (file)
@@ -90,7 +90,7 @@ char *RunmodeAutoFpCreatePickupQueuesString(int n)
         if (strlen(queues) > 0)
             strlcat(queues, ",", queues_size);
 
-        snprintf(qname, sizeof(qname), "pickup%"PRIu16, thread+1);
+        snprintf(qname, sizeof(qname), "pickup%d", thread+1);
         strlcat(queues, qname, queues_size);
     }
 
@@ -147,7 +147,7 @@ int RunModeSetLiveCaptureAutoFp(ConfigIfaceParserFunc ConfigParser,
 
         /* create the threads */
         for (thread = 0; thread < threads_count; thread++) {
-            snprintf(tname, sizeof(tname), "%s%"PRIu16, thread_name, thread+1);
+            snprintf(tname, sizeof(tname), "%s%d", thread_name, thread+1);
             char *thread_name = SCStrdup(tname);
             if (unlikely(thread_name == NULL)) {
                 SCLogError(SC_ERR_MEM_ALLOC, "Can't allocate thread name");
@@ -209,7 +209,7 @@ int RunModeSetLiveCaptureAutoFp(ConfigIfaceParserFunc ConfigParser,
 
             threads_count = ModThreadsCount(aconf);
             for (thread = 0; thread < threads_count; thread++) {
-                snprintf(tname, sizeof(tname), "%s%s%"PRIu16, thread_name,
+                snprintf(tname, sizeof(tname), "%s%s%d", thread_name,
                          live_dev, thread+1);
                 char *thread_name = SCStrdup(tname);
                 if (unlikely(thread_name == NULL)) {
@@ -249,8 +249,8 @@ int RunModeSetLiveCaptureAutoFp(ConfigIfaceParserFunc ConfigParser,
     }
 
     for (thread = 0; thread < thread_max; thread++) {
-        snprintf(tname, sizeof(tname), "Detect%"PRIu16, thread+1);
-        snprintf(qname, sizeof(qname), "pickup%"PRIu16, thread+1);
+        snprintf(tname, sizeof(tname), "Detect%d", thread+1);
+        snprintf(qname, sizeof(qname), "pickup%d", thread+1);
 
         SCLogDebug("tname %s, qname %s", tname, qname);
 
@@ -341,7 +341,7 @@ static int RunModeSetLiveCaptureWorkersForDevice(ConfigIfaceThreadsCountFunc Mod
         if (single_mode) {
             snprintf(tname, sizeof(tname), "%s", thread_name);
         } else {
-            snprintf(tname, sizeof(tname), "%s%s%"PRIu16,
+            snprintf(tname, sizeof(tname), "%s%s%d",
                      thread_name, live_dev, thread+1);
         }
         n_thread_name = SCStrdup(tname);
@@ -557,8 +557,8 @@ int RunModeSetIPSAutoFp(ConfigIPSParserFunc ConfigParser,
 
     }
     for (thread = 0; thread < thread_max; thread++) {
-        snprintf(tname, sizeof(tname), "Detect%"PRIu16, thread+1);
-        snprintf(qname, sizeof(qname), "pickup%"PRIu16, thread+1);
+        snprintf(tname, sizeof(tname), "Detect%d", thread+1);
+        snprintf(qname, sizeof(qname), "pickup%d", thread+1);
 
         SCLogDebug("tname %s, qname %s", tname, qname);
 
@@ -612,7 +612,7 @@ int RunModeSetIPSAutoFp(ConfigIPSParserFunc ConfigParser,
     /* create the threads */
     for (int i = 0; i < nqueue; i++) {
         memset(tname, 0, sizeof(tname));
-        snprintf(tname, sizeof(tname), "Verdict%"PRIu16, i);
+        snprintf(tname, sizeof(tname), "Verdict%d", i);
 
         char *thread_name = SCStrdup(tname);
         if (unlikely(thread_name == NULL)) {