]> The Tcpdump Group git mirrors - tcpdump/commitdiff
Eliminate printf format warnings.
authorfenner <fenner>
Wed, 15 Dec 1999 00:34:10 +0000 (00:34 +0000)
committerfenner <fenner>
Wed, 15 Dec 1999 00:34:10 +0000 (00:34 +0000)
Don't use len without initializing in ip_printts()
 (in the case of an invalid type).

print-ip.c

index 34be5c82c85b90a28f1b85bb4c7c7c1f544b47f3..1eddff59f24dfaa6e3ccc5641535375d3772b88a 100644 (file)
@@ -21,7 +21,7 @@
 
 #ifndef lint
 static const char rcsid[] =
 
 #ifndef lint
 static const char rcsid[] =
-    "@(#) $Header: /tcpdump/master/tcpdump/print-ip.c,v 1.77 1999-11-23 08:31:10 fenner Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/tcpdump/print-ip.c,v 1.78 1999-12-15 00:34:10 fenner Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -73,7 +73,7 @@ struct tr_query {
        u_int  tr_rttlqid;              /* response ttl and qid */
 };
 
        u_int  tr_rttlqid;              /* response ttl and qid */
 };
 
-#define TR_GETTTL(x)           (((x) >> 24) & 0xff)
+#define TR_GETTTL(x)           (int)(((x) >> 24) & 0xff)
 #define TR_GETQID(x)           ((x) & 0x00ffffff)
 
 /*
 #define TR_GETQID(x)           ((x) & 0x00ffffff)
 
 /*
@@ -119,7 +119,7 @@ static void print_mtrace(register const u_char *bp, register u_int len)
 {
        register struct tr_query *tr = (struct tr_query *)(bp + 8);
 
 {
        register struct tr_query *tr = (struct tr_query *)(bp + 8);
 
-       printf("mtrace %d: %s to %s reply-to %s",
+       printf("mtrace %ld: %s to %s reply-to %s",
                TR_GETQID(ntohl(tr->tr_rttlqid)),
                ipaddr_string(&tr->tr_src), ipaddr_string(&tr->tr_dst),
                ipaddr_string(&tr->tr_raddr));
                TR_GETQID(ntohl(tr->tr_rttlqid)),
                ipaddr_string(&tr->tr_src), ipaddr_string(&tr->tr_dst),
                ipaddr_string(&tr->tr_raddr));
@@ -131,7 +131,7 @@ static void print_mresp(register const u_char *bp, register u_int len)
 {
        register struct tr_query *tr = (struct tr_query *)(bp + 8);
 
 {
        register struct tr_query *tr = (struct tr_query *)(bp + 8);
 
-       printf("mresp %d: %s to %s reply-to %s",
+       printf("mresp %ld: %s to %s reply-to %s",
                TR_GETQID(ntohl(tr->tr_rttlqid)),
                ipaddr_string(&tr->tr_src), ipaddr_string(&tr->tr_dst),
                ipaddr_string(&tr->tr_raddr));
                TR_GETQID(ntohl(tr->tr_rttlqid)),
                ipaddr_string(&tr->tr_src), ipaddr_string(&tr->tr_dst),
                ipaddr_string(&tr->tr_raddr));
@@ -236,7 +236,7 @@ static void
 ip_printts(register const u_char *cp, u_int length)
 {
        register u_int ptr = cp[2] - 1;
 ip_printts(register const u_char *cp, u_int length)
 {
        register u_int ptr = cp[2] - 1;
-       register u_int len;
+       register u_int len = 0;
        int hoplen;
        char *type;
 
        int hoplen;
        char *type;
 
@@ -274,7 +274,7 @@ ip_printts(register const u_char *cp, u_int length)
        for (len = 4; len < length; len += hoplen) {
                if (ptr == len)
                        type = " ^ ";
        for (len = 4; len < length; len += hoplen) {
                if (ptr == len)
                        type = " ^ ";
-               printf("%s%d@%s", type, ntohl(*(u_int32_t *)&cp[len+hoplen-4]),
+               printf("%s%d@%s", type, EXTRACT_32BITS(&cp[len+hoplen-4]),
                       hoplen!=8 ? "" : ipaddr_string(&cp[len]));
                type = " ";
        }
                       hoplen!=8 ? "" : ipaddr_string(&cp[len]));
                type = " ";
        }