]> The Tcpdump Group git mirrors - tcpdump/blobdiff - tcpdump.c
Add length checks.
[tcpdump] / tcpdump.c
index aa4b39846d55a9b1c9ffdd8107fb2862dfad328c..1cb5130090940793f74e211bd35eabf0fd89e042 100644 (file)
--- a/tcpdump.c
+++ b/tcpdump.c
@@ -30,7 +30,7 @@ static const char copyright[] _U_ =
     "@(#) Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 2000\n\
 The Regents of the University of California.  All rights reserved.\n";
 static const char rcsid[] _U_ =
-    "@(#) $Header: /tcpdump/master/tcpdump/tcpdump.c,v 1.216.2.7 2004-01-14 03:25:28 guy Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/tcpdump/tcpdump.c,v 1.216.2.10 2004-03-17 19:47:48 guy Exp $ (LBL)";
 #endif
 
 /*
@@ -205,6 +205,9 @@ static struct printer printers[] = {
 #endif
 #ifdef DLT_ENC
        { enc_if_print,         DLT_ENC },
+#endif
+#ifdef DLT_APPLE_IP_OVER_IEEE1394
+       { ap1394_if_print,      DLT_APPLE_IP_OVER_IEEE1394 },
 #endif
        { NULL,                 0 },
 };
@@ -941,13 +944,18 @@ dump_packet_and_trunc(u_char *user, const struct pcap_pkthdr *h, const u_char *s
         * file could put it over Cflag.
         */
        if (ftell((FILE *)dump_info->p) > Cflag) {
+               /*
+                * Close the current file and open a new one.
+                */
+               pcap_dump_close(dump_info->p);
+               if (cnt >= 1000)
+                       error("too many output files");
                name = (char *) malloc(strlen(dump_info->WFileName) + 4);
                if (name == NULL)
                        error("dump_packet_and_trunc: malloc");
                strcpy(name, dump_info->WFileName);
                swebitoa(cnt, name + strlen(dump_info->WFileName));
                cnt++;
-               pcap_dump_close(dump_info->p);
                dump_info->p = pcap_dump_open(dump_info->pd, name);
                free(name);
                if (dump_info->p == NULL)