NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

bin/45841: Incorrect use of sizeof in tcpdump.



>Number:         45841
>Category:       bin
>Synopsis:       Incorrect use of sizeof in tcpdump.
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Jan 16 08:30:00 +0000 2012
>Originator:     Henning Petersen
>Release:        NetBSD-current
>Organization:
>Environment:
>Description:
Incorrect use of sizeof in print-eigrip, print-ldp.c, print-lmp.c, 
print-lspping.c, print-rsvp.c and print-slow.c .
Found by cppcheck.
>How-To-Repeat:

>Fix:
diff -u -p -r1.2 print-eigrp.c
--- external/bsd/tcpdump/dist/print-eigrp.c     5 Dec 2010 05:11:30 -0000       
1.2
+++ external/bsd/tcpdump/dist/print-eigrp.c     28 Dec 2011 07:36:44 -0000
@@ -285,7 +285,7 @@ eigrp_print(register const u_char *pptr,
 
         if (eigrp_tlv_len < sizeof(struct eigrp_tlv_header) ||
             eigrp_tlv_len > tlen) {
-            print_unknown_data(tptr+sizeof(sizeof(struct 
eigrp_tlv_header)),"\n\t    ",tlen);
+            print_unknown_data(tptr+sizeof(struct eigrp_tlv_header),"\n\t    
",tlen);
             return;
         }
 
@@ -473,7 +473,7 @@ eigrp_print(register const u_char *pptr,
         }
         /* do we want to see an additionally hexdump ? */
         if (vflag > 1)
-            print_unknown_data(tptr+sizeof(sizeof(struct 
eigrp_tlv_header)),"\n\t    ",
+            print_unknown_data(tptr+sizeof(struct eigrp_tlv_header),"\n\t    ",
                                eigrp_tlv_len-sizeof(struct eigrp_tlv_header));
 
         tptr+=eigrp_tlv_len;
===================================================================
diff -u -p -r1.2 print-ldp.c
--- external/bsd/tcpdump/dist/print-ldp.c       5 Dec 2010 05:11:30 -0000       
1.2
+++ external/bsd/tcpdump/dist/print-ldp.c       28 Dec 2011 07:36:44 -0000
@@ -614,7 +614,7 @@ ldp_msg_print(register const u_char *ppt
         }
         /* do we want to see an additionally hexdump ? */
         if (vflag > 1 || hexdump==TRUE)
-            print_unknown_data(tptr+sizeof(sizeof(struct 
ldp_msg_header)),"\n\t  ",
+            print_unknown_data(tptr+sizeof(struct ldp_msg_header),"\n\t  ",
                                msg_len);
 
         tptr += msg_len+4;
===================================================================
diff -u -p -r1.2 print-lmp.c
--- external/bsd/tcpdump/dist/print-lmp.c       5 Dec 2010 05:11:30 -0000       
1.2
+++ external/bsd/tcpdump/dist/print-lmp.c       28 Dec 2011 07:36:45 -0000
@@ -876,7 +876,7 @@ lmp_print(register const u_char *pptr, r
         }
         /* do we want to see an additionally hexdump ? */
         if (vflag > 1 || hexdump==TRUE)
-            print_unknown_data(tptr+sizeof(sizeof(struct 
lmp_object_header)),"\n\t    ",
+            print_unknown_data(tptr+sizeof(struct lmp_object_header),"\n\t    
",
                                lmp_obj_len-sizeof(struct lmp_object_header));
 
         tptr+=lmp_obj_len;
===================================================================
diff -u -p -r1.2 print-lspping.c
--- external/bsd/tcpdump/dist/print-lspping.c   5 Dec 2010 05:11:30 -0000       
1.2
+++ external/bsd/tcpdump/dist/print-lspping.c   28 Dec 2011 07:36:46 -0000
@@ -883,7 +883,7 @@ lspping_print(register const u_char *ppt
         }
         /* do we want to see an additionally tlv hexdump ? */
         if (vflag > 1 || tlv_hexdump==TRUE)
-            print_unknown_data(tptr+sizeof(sizeof(struct 
lspping_tlv_header)),"\n\t    ",
+            print_unknown_data(tptr+sizeof(struct lspping_tlv_header),"\n\t    
",
                                lspping_tlv_len);
 
 
===================================================================
diff -u -p -r1.2 print-rsvp.c
--- external/bsd/tcpdump/dist/print-rsvp.c      5 Dec 2010 05:11:30 -0000       
1.2
+++ external/bsd/tcpdump/dist/print-rsvp.c      28 Dec 2011 07:36:48 -0000
@@ -1795,7 +1795,7 @@ _U_
         }
         /* do we also want to see a hex dump ? */
         if (vflag > 1 || hexdump==TRUE)
-            print_unknown_data(tptr+sizeof(sizeof(struct 
rsvp_object_header)),"\n\t    ", /* FIXME indentation */
+            print_unknown_data(tptr+sizeof(struct rsvp_object_header),"\n\t    
", /* FIXME indentation */
                                rsvp_obj_len-sizeof(struct rsvp_object_header));
 
         tptr+=rsvp_obj_len;
===================================================================
diff -u -p -r1.2 print-slow.c
--- external/bsd/tcpdump/dist/print-slow.c      5 Dec 2010 05:11:30 -0000       
1.2
+++ external/bsd/tcpdump/dist/print-slow.c      28 Dec 2011 07:36:48 -0000
@@ -373,7 +373,7 @@ void slow_marker_lacp_print(register con
             tlv_header->type != LACP_TLV_TERMINATOR &&
             tlv_header->type != MARKER_TLV_TERMINATOR) {
             printf("\n\t-----trailing data-----");
-            print_unknown_data(tptr+sizeof(sizeof(struct tlv_header_t)),"\n\t  
",tlen);
+            print_unknown_data(tptr+sizeof(struct tlv_header_t),"\n\t  ",tlen);
             return;
         }
 
@@ -446,7 +446,7 @@ void slow_marker_lacp_print(register con
         }
         /* do we want to see an additional hexdump ? */
         if (vflag > 1) {
-            print_unknown_data(tptr+sizeof(sizeof(struct tlv_header_t)),"\n\t  
",
+            print_unknown_data(tptr+sizeof(struct tlv_header_t),"\n\t  ",
                                tlv_len-sizeof(struct tlv_header_t));
         }
 



Home | Main Index | Thread Index | Old Index