diff options
author | Otto Moerbeek <otto@cvs.openbsd.org> | 2006-02-15 20:34:24 +0000 |
---|---|---|
committer | Otto Moerbeek <otto@cvs.openbsd.org> | 2006-02-15 20:34:24 +0000 |
commit | ea67a2021b0833d0a78b81c4d904820b5baaed10 (patch) | |
tree | 5ff9547b42237e1fb4d27c4d4d62d59156731f2a /usr.sbin | |
parent | c2b6135d064bbbb7b57e7e78e22304de415a192a (diff) |
Initialize snaplen also when reading a dump file. Fixes problems
on 64bit archs when processing files with large snaplens, as seen
by Alf Schlichting. ok moritz@ canacar@
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/tcpdump/tcpdump.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/usr.sbin/tcpdump/tcpdump.c b/usr.sbin/tcpdump/tcpdump.c index 369b0494f6b..d0fc74234fb 100644 --- a/usr.sbin/tcpdump/tcpdump.c +++ b/usr.sbin/tcpdump/tcpdump.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tcpdump.c,v 1.48 2005/11/18 11:06:51 djm Exp $ */ +/* $OpenBSD: tcpdump.c,v 1.49 2006/02/15 20:34:23 otto Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997 @@ -26,7 +26,7 @@ static const char copyright[] = "@(#) Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997\n\ The Regents of the University of California. All rights reserved.\n"; static const char rcsid[] = - "@(#) $Header: /cvs/OpenBSD/src/usr.sbin/tcpdump/tcpdump.c,v 1.48 2005/11/18 11:06:51 djm Exp $ (LBL)"; + "@(#) $Header: /cvs/OpenBSD/src/usr.sbin/tcpdump/tcpdump.c,v 1.49 2006/02/15 20:34:23 otto Exp $ (LBL)"; #endif /* @@ -429,18 +429,17 @@ main(int argc, char **argv) error("%s", ebuf); /* state: STATE_BPF */ - i = pcap_snapshot(pd); - if (snaplen < i) { - warning("snaplen raised from %d to %d", snaplen, i); - snaplen = i; - } - if (pcap_lookupnet(device, &localnet, &netmask, ebuf)) { warning("%s", ebuf); localnet = 0; netmask = 0; } } + i = pcap_snapshot(pd); + if (snaplen < i) { + warning("snaplen raised from %d to %d", snaplen, i); + snaplen = i; + } if (Lflag) { pcap_list_linktypes(pd); |