Convert a bunch of uses of "fd->cap_len" to use "pi.captured_len" (or to
authorguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>
Thu, 26 Aug 1999 07:34:43 +0000 (07:34 +0000)
committerguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>
Thu, 26 Aug 1999 07:34:43 +0000 (07:34 +0000)
use END_OF_FRAME), so that they don't look at stuff in an IP datagram
past the end of the IP datagram (i.e., frame padding).

git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@584 f5534014-38df-0310-8fa8-9805f1628bb7

packet-bootp.c
packet-giop.c
packet-gre.c
packet-isakmp.c
packet-ospf.c
packet-pptp.c
packet-rip.c
packet-smb.c

index 94d13636f39ab478246d6471751e8bbc3bedf776..d24ba465ae43279e9152cb61243cc74668c8b919 100644 (file)
@@ -2,7 +2,7 @@
  * Routines for BOOTP/DHCP packet disassembly
  * Gilbert Ramirez <gram@verdict.uthscsa.edu>
  *
- * $Id: packet-bootp.c,v 1.18 1999/07/29 05:46:52 gram Exp $
+ * $Id: packet-bootp.c,v 1.19 1999/08/26 07:34:43 guy Exp $
  *
  * The information used comes from:
  * RFC 2132: DHCP Options and BOOTP Vendor Extensions
@@ -517,7 +517,7 @@ dissect_bootp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree)
                }
 
                voff = offset+240;
-               eoff = fd->cap_len;
+               eoff = pi.captured_len;
 
                while (voff < eoff) {
                        voff += bootp_option(pd, bp_tree, voff, eoff);
index 45558b667b61497dc68a39c6806aa6f92033e0c7..feae91679d89350622ae53b3008aa5825d4137b5 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Laurent Deniel <deniel@worldnet.fr>
  *
- * $Id: packet-giop.c,v 1.4 1999/07/29 05:46:54 gram Exp $
+ * $Id: packet-giop.c,v 1.5 1999/08/26 07:34:42 guy Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@zing.org>
@@ -211,7 +211,7 @@ void dissect_giop(const u_char *pd, int offset, frame_data *fd, proto_tree *tree
 
 #define END_OF_GIOP_MESSAGE (offset - first_offset - GIOP_HEADER_SIZE)
 
-  if (fd->cap_len < offset + GIOP_HEADER_SIZE) {
+  if (pi.captured_len < offset + GIOP_HEADER_SIZE) {
     dissect_data(pd, offset, fd, tree);
     return;
   }
@@ -304,7 +304,7 @@ void dissect_giop(const u_char *pd, int offset, frame_data *fd, proto_tree *tree
 
   offset += GIOP_HEADER_SIZE;
 
-  if (fd->cap_len < offset + message_size) {
+  if (pi.captured_len < offset + message_size) {
     dissect_data(pd, offset, fd, tree);
     return;
   }
@@ -691,7 +691,7 @@ void dissect_giop(const u_char *pd, int offset, frame_data *fd, proto_tree *tree
 
   offset = first_offset + GIOP_HEADER_SIZE + message_size;
 
-  if (offset < fd->cap_len) {
+  if (offset < pi.captured_len) {
     dissect_data(pd, offset, fd, tree);
   }
 
index 21d3b02ef4c3bc420292ee1371876fa06980c625..9a6a57fbd7e2e6e1aa07ffdd976c00f7d3e6179f 100644 (file)
@@ -2,7 +2,7 @@
  * Routines for the Generic Routing Encapsulation (GRE) protocol
  * Brad Robel-Forrest <brad.robel-forrest@watchguard.com>
  *
- * $Id: packet-gre.c,v 1.4 1999/07/29 05:46:55 gram Exp $
+ * $Id: packet-gre.c,v 1.5 1999/08/26 07:34:42 guy Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@unicom.net>
@@ -77,7 +77,7 @@ dissect_gre(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) {
       col_add_str(fd, COL_INFO, "Encapsulated unknown");
   }
                
-  if (fd->cap_len > offset && tree) {
+  if (pi.captured_len > offset && tree) {
     int                        is_ppp;
     proto_item *       ti;
     proto_tree *       gre_tree;
index c6267a0904e403ac9daeb01711918f4af303714a..65867c86da5c23da4b7b1e133467e6910fd39a0f 100644 (file)
@@ -2,7 +2,7 @@
  * Routines for the Internet Security Association and Key Management Protocol (ISAKMP)
  * Brad Robel-Forrest <brad.robel-forrest@watchguard.com>
  *
- * $Id: packet-isakmp.c,v 1.7 1999/07/29 05:46:57 gram Exp $
+ * $Id: packet-isakmp.c,v 1.8 1999/08/26 07:34:41 guy Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@unicom.net>
@@ -289,7 +289,7 @@ void dissect_isakmp(const u_char *pd, int offset, frame_data *fd, proto_tree *tr
   if (check_col(fd, COL_INFO))
     col_add_fstr(fd, COL_INFO, "%s", exchtype2str(hdr->exch_type));
   
-  if (fd->cap_len > offset && tree) {
+  if (pi.captured_len > offset && tree) {
     proto_item *       ti;
     proto_tree *       isakmp_tree;
     
index fe5d6f0d7a2e5b69040460f85d0ce97c2d9ebde0..6848f4c01e50a636f6c4dc790752278ad6a0f3eb 100644 (file)
@@ -2,7 +2,7 @@
  * Routines for OSPF packet disassembly
  * (c) Copyright Hannes R. Boehm <hannes@boehm.org>
  *
- * $Id: packet-ospf.c,v 1.12 1999/07/29 05:47:01 gram Exp $
+ * $Id: packet-ospf.c,v 1.13 1999/08/26 07:34:41 guy Exp $
  *
  * At this time, this module is able to analyze OSPF
  * packets as specified in RFC2328. MOSPF (RFC1584) and other
@@ -162,7 +162,7 @@ dissect_ospf_hello(const u_char *pd, int offset, frame_data *fd, proto_tree *tre
     memcpy(&ospfhello, &pd[offset], sizeof(e_ospf_hello));
 
     if (tree) {
-       ti = proto_tree_add_text(tree, offset, (fd->cap_len - offset) , "OSPF Hello Packet"); 
+       ti = proto_tree_add_text(tree, offset, END_OF_FRAME, "OSPF Hello Packet"); 
        ospf_hello_tree = proto_item_add_subtree(ti, ETT_OSPF_HELLO);
 
 
@@ -200,8 +200,8 @@ dissect_ospf_hello(const u_char *pd, int offset, frame_data *fd, proto_tree *tre
 
 
        offset+=20;
-       while(((int)(fd->cap_len - offset)) >= 4){
-           printf("%d", fd->cap_len - offset);
+       while(((int)(pi.captured_len - offset)) >= 4){
+           printf("%d", pi.captured_len - offset);
            ospfneighbor=(guint32 *) &pd[offset];
            proto_tree_add_text(ospf_hello_tree, offset, 4, "Active Neighbor: %s",  ip_to_str((guint8 *) ospfneighbor));
            offset+=4;
@@ -223,7 +223,7 @@ dissect_ospf_db_desc(const u_char *pd, int offset, frame_data *fd, proto_tree *t
     memcpy(&ospf_dbd, &pd[offset], sizeof(e_ospf_dbd));
 
     if (tree) {
-       ti = proto_tree_add_text(tree, offset, (fd->cap_len - offset) , "OSPF DB Description"); 
+       ti = proto_tree_add_text(tree, offset, END_OF_FRAME, "OSPF DB Description"); 
        ospf_db_desc_tree = proto_item_add_subtree(ti, ETT_OSPF_DESC);
 
        proto_tree_add_text(ospf_db_desc_tree, offset, 2, "Interface MTU: %d", ntohs(ospf_dbd.interface_mtu) );
@@ -274,7 +274,7 @@ dissect_ospf_db_desc(const u_char *pd, int offset, frame_data *fd, proto_tree *t
     /* LS Headers will be processed here */
     /* skip to the end of DB-Desc header */
     offset+=8;
-    while( ((int) (fd->cap_len - offset)) >= OSPF_LSA_HEADER_LENGTH ) {
+    while( ((int) (pi.captured_len - offset)) >= OSPF_LSA_HEADER_LENGTH ) {
        dissect_ospf_lsa(pd, offset, fd, tree, FALSE);
        offset+=OSPF_LSA_HEADER_LENGTH;
     }
@@ -291,7 +291,7 @@ dissect_ospf_ls_req(const u_char *pd, int offset, frame_data *fd, proto_tree *tr
     /* zero or more LS requests may be within a LS Request */
     /* we place every request for a LSA in a single subtree */
     if (tree) {
-       while( ((int) ( fd->cap_len - offset)) >= OSPF_LS_REQ_LENGTH ){
+       while( ((int) (pi.captured_len - offset)) >= OSPF_LS_REQ_LENGTH ){
              memcpy(&ospf_lsr, &pd[offset], sizeof(e_ospf_ls_req));
             ti = proto_tree_add_text(tree, offset, OSPF_LS_REQ_LENGTH, "Link State Request"); 
             ospf_lsr_tree = proto_item_add_subtree(ti, ETT_OSPF_LSR);
@@ -342,7 +342,7 @@ dissect_ospf_ls_upd(const u_char *pd, int offset, frame_data *fd, proto_tree *tr
     memcpy(&upd_hdr, &pd[offset], sizeof(e_ospf_lsa_upd_hdr));
 
     if (tree) {
-       ti = proto_tree_add_text(tree, offset, (fd->cap_len - offset) , "LS Update Packet"); 
+       ti = proto_tree_add_text(tree, offset, END_OF_FRAME, "LS Update Packet"); 
        ospf_lsa_upd_tree = proto_item_add_subtree(ti, ETT_OSPF_LSA_UPD);
 
        proto_tree_add_text(ospf_lsa_upd_tree, offset, 4, "Nr oF LSAs: %ld", (long)ntohl(upd_hdr.lsa_nr) );
@@ -361,7 +361,7 @@ void
 dissect_ospf_ls_ack(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) {
 
     /* the body of a LS Ack packet simply contains zero or more LSA Headers */
-    while( ((int)(fd->cap_len - offset)) >= OSPF_LSA_HEADER_LENGTH ) {
+    while( ((int)(pi.captured_len - offset)) >= OSPF_LSA_HEADER_LENGTH ) {
        dissect_ospf_lsa(pd, offset, fd, tree, FALSE);
        offset+=OSPF_LSA_HEADER_LENGTH;
     }
@@ -523,7 +523,7 @@ dissect_ospf_lsa(const u_char *pd, int offset, frame_data *fd, proto_tree *tree,
                                                  ip_to_str((guint8 *) &(network_lsa.network_mask)));
                offset += 4;
 
-               while( ((int) (fd->cap_len - offset)) >= 4){
+               while( ((int) (pi.captured_len - offset)) >= 4){
                    attached_router = (guint32 *) &pd[offset];
                    proto_tree_add_text(ospf_lsa_tree, offset, 4, "Attached Router: %s", 
                                                  ip_to_str((guint8 *) attached_router));
@@ -567,7 +567,7 @@ dissect_ospf_lsa(const u_char *pd, int offset, frame_data *fd, proto_tree *tree,
                 break;
             default:
                /* unknown LSA type */
-               proto_tree_add_text(ospf_lsa_tree, offset, (fd->cap_len - offset), "Unknown LSA Type");
+               proto_tree_add_text(ospf_lsa_tree, offset, END_OF_FRAME, "Unknown LSA Type");
         }
     }
     /* return the length of this LSA */
index a29f2c18a1746383c578edde2317771b3077bb90..376434ab1a4fd75f130ccac4648019b37890ff01 100644 (file)
@@ -2,7 +2,7 @@
  * Routines for the Point-to-Point Tunnelling Protocol (PPTP)
  * Brad Robel-Forrest <brad.robel-forrest@watchguard.com>
  *
- * $Id: packet-pptp.c,v 1.3 1999/07/13 02:52:53 gram Exp $
+ * $Id: packet-pptp.c,v 1.4 1999/08/26 07:34:40 guy Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@unicom.net>
@@ -390,7 +390,7 @@ dissect_pptp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) {
   if (check_col(fd, COL_INFO))
     col_add_fstr(fd, COL_INFO, "%s", cntrltype2str(cntrl_type));
     
-  if (fd->cap_len > offset && tree) {
+  if (pi.captured_len > offset && tree) {
     guint16            msg_type;
     proto_item *       ti;
     proto_tree *       pptp_tree;
index c2fa6c7f89f66c8fb77731cd6695f411a1996396..f81efc48fcaacfa11298fd783458f9882fb446a3 100644 (file)
@@ -2,7 +2,7 @@
  * Routines for RIPv1 and RIPv2 packet disassembly
  * (c) Copyright Hannes R. Boehm <hannes@boehm.org>
  *
- * $Id: packet-rip.c,v 1.11 1999/08/04 00:33:11 guy Exp $
+ * $Id: packet-rip.c,v 1.12 1999/08/26 07:34:40 guy Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@zing.org>
@@ -92,7 +92,7 @@ dissect_rip(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) {
         col_add_str(fd, COL_INFO, packet_type[rip_header.command]); 
 
     if (tree) {
-       ti = proto_tree_add_item(tree, proto_rip, offset, (fd->cap_len - offset), NULL);
+       ti = proto_tree_add_item(tree, proto_rip, offset, END_OF_FRAME, NULL);
        rip_tree = proto_item_add_subtree(ti, ETT_RIP);
 
        proto_tree_add_text(rip_tree, offset, 1, "Command: %d (%s)", rip_header.command, packet_type[rip_header.command]); 
@@ -105,7 +105,7 @@ dissect_rip(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) {
 
         /* zero or more entries */
 
-       while((fd->cap_len - offset) >= RIP_ENTRY_LENGTH){
+       while((pi.captured_len - offset) >= RIP_ENTRY_LENGTH){
            memcpy(&rip_entry, &pd[offset], sizeof(rip_entry)); /* avoid alignment problem */
            family = ntohs(rip_entry.vektor.family);
            switch (family) {
index 82acd5b1208087e24395c4c37f75489b2e5f7efc..98b5aca7842dc1a8b2a60c0575d2464554a09bd8 100644 (file)
@@ -2,7 +2,7 @@
  * Routines for smb packet dissection
  * Copyright 1999, Richard Sharpe <rsharpe@ns.aus.com>
  *
- * $Id: packet-smb.c,v 1.23 1999/08/24 17:26:14 gram Exp $
+ * $Id: packet-smb.c,v 1.24 1999/08/26 07:34:38 guy Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@unicom.net>
@@ -1444,7 +1444,7 @@ dissect_negprot_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *tr
 
     }
 
-    while (fd->cap_len > offset) {
+    while (pi.captured_len > offset) {
       const char *str;
 
       if (tree) {