Commit Graph

66 Commits

Author SHA1 Message Date
Denis Ovsienko
74e12dfb8d AppleTalk: Address a few cppcheck style notices.
[print-atalk.c:283]: (style) The scope of the variable 'c' can be
reduced.
[print-atalk.c:380]: (style) The scope of the variable 'c' can be
reduced.
[print-atalk.c:360]: (style) Variable 'c' is assigned a value that is
never used.
2017-09-06 09:58:36 +01:00
Francois-Xavier Le Bail
1e28562171 Fix a trailing tab 2017-01-18 09:16:38 +01:00
Guy Harris
b56aab3862 CVE-2016-7973/Add bounds and length checks.
Fixes heap overflows found with American Fuzzy Lop by Hanno Böck.
2017-01-18 09:16:36 +01:00
Guy Harris
83a7bda410 Pass the actual frame length to llap_print().
That way, it can properly do the check against that length; it also does
bounds checks, so it'll catch running past the snapshot length.
2017-01-18 09:16:36 +01:00
Guy Harris
5cace72820 Check against the packet length first.
That way, if the packet is inherently too short, rather than just having
been cut short by the snapshot length, we'll report that properly.
2017-01-18 09:16:35 +01:00
Guy Harris
5356a9ea69 CVE-2016-7973/Add some bounds checks.
Fixes a heap overflow found with American Fuzzy Lop by Hanno Böck.
2017-01-18 09:16:35 +01:00
Francois-Xavier Le Bail
b38f324af9 Add a summary comment in all other printers
Moreover:
Remove some redundant comments
Update some summary comments
Update the specification URL for ATA over Ethernet (AoE) protocol
2016-08-15 22:42:38 +02:00
Francois-Xavier Le Bail
11d3a01319 Move the printer summaries from INSTALL.txt to each printer
with the tag '\summary:' for greping.
Remark: Currently some printers have no summary line.

Moreover:
Summarize all printers with a single line in INSTALL.txt
2016-08-14 17:03:43 +02:00
Francois-Xavier Le Bail
99c91c3aec Rename 'tcpdump-stdinc.h' to 'netdissect-stdinc.h'
Get the full log via: git log --follow netdissect-stdinc.h
2015-09-10 08:50:40 +02:00
Francois-Xavier Le Bail
b638c78b40 Remove obsolete comments 2015-09-07 15:01:46 +02:00
Francois-Xavier Le Bail
c1c3c77463 Printers must include 'netdissect.h', not 'interface.h' 2015-09-05 23:35:58 +02:00
Francois-Xavier Le Bail
e847135d66 Functions in libnetdissect must use ndo_error() function 2015-09-05 22:52:11 +02:00
Francois-Xavier Le Bail
71d0745d3d Printers must use ndo_error() function (via ndo->ndo_error) 2015-09-05 20:20:57 +02:00
Bill Parker
95d2a0d1ee Add checks for strdup() failure. 2015-07-13 12:59:46 -07:00
Guy Harris
69cb46af91 Fix a bunch of de-constifications. 2015-04-26 17:24:42 -07:00
Denis Ovsienko
38700c7f24 dismiss NETDISSECT_REWORKED macro
The purpose of this macro was to enable the file-by-file switch to NDO,
after which only tcpdump.c had a use of it and the definitions guarded
by it. Update tcpdump.c not to require them any more and dismiss the
unused definitions.
2015-03-22 10:06:15 +00:00
Guy Harris
a2633f2f21 More fixes for uint8_t being shorter than u_int8_t.
Fix a typo while we're at it.
2014-04-23 11:53:22 -07:00
Guy Harris
ed85e20e4d u_intN_t is dead, long live uintN_t.
And, as we require at least autoconf 2.61, and as autoconf 2.61 and
later have AC_TYPE_UINTn_T and AC_TYPE_INTn_T macros, we use them to
define the uintN_t and intN_t macros if the system doesn't define them
for us.

This lets us get rid of bitypes.h as well.
2014-04-23 00:20:40 -07:00
Guy Harris
1cde6435df Netdissectify the to-name resolution routines.
Have them take a netdissect_options * argument, and get the "no name
resolution" flag from it.

Move the declaration of dnaddr_string to addrtoname.h, along with the
other XXX-to-string routines.
2014-04-04 00:43:46 -07:00
Denis Ovsienko
b46194277a spell "%s" format strings (complements 708a68a)
Make "%s" format string always reside in the print function call
explicitly such that the reader doesn't have to assess its safety.
2014-03-31 15:43:22 +04:00
Denis Ovsienko
5d85aa67ed NDOize AppleTalk, CDP and Kerberos decoders 2014-03-28 16:02:56 +04:00
Denis Ovsienko
d57e945e5e NDOize EIGRP, ICMP, L2TP, STP and UDP decoders 2014-03-15 23:25:06 +04:00
Denis Ovsienko
88e479b75e don't include pcap.h needlessly
Both interface.h and netdissect.h include <pcap.h>, thus most files
should not include it regardless if these need it or not. The only
exceptions so far remain:
* addrtoname.c
* missing/datalinks.c
* missing/dlnames.c
* tcpdump.c
2014-02-28 18:11:09 +04:00
Denis Ovsienko
fe3253b9b8 remove tcpdump's own CVS keywords
Remove lots of $Header's and a few $Id's that all belong to the former
CVS repository of tcpdump itself. These keywords have been frozen since
the migration to git in late 2008.
2014-01-03 00:59:08 +04:00
Denis Ovsienko
d8acd8f5d0 make consistent use of the "tstr" idiom
For each decoder that has more than one instance of truncation signaling
and prints the same string in each instance make sure that the string is
declared as "static const char tstr[]" right after the initial includes
block. Where necessary, replace fputs(s, stdout) with equivalent
printf("%s", s).
2013-12-26 18:19:50 +04:00
Denis Ovsienko
7de355927b justify declarations of struct tok arrays
Make sure all of them are declared const and most of them -- static.
Proper declaration of token arrays is a common review point for new code
that is based on existing decoders. Thus fix the issue at its root.
2013-09-24 20:54:03 +04:00
Guy Harris
d4d28dc3c8 Fix potential (but not actual) buffer overflow risk.
The line buffer is 256 bytes long, so the name subfield in the line
can't be bigger than 256 bytes, but

	1) somebody could make the line buffer bigger

and

	2) this way the format item and buffer size match

so we'll do it anyway.
2013-07-31 11:33:15 -07:00
Jakub Zawadzki
78bf524046 Fix possible buffer overflow while doing sscanf()
MAXHOSTNAMELEN + 100 is only 164 which is less than 256 sscanf() buffer.
Fix it by increasing size of nambuf buffer.
2013-07-30 23:18:55 +02:00
Guy Harris
b7ab4b7209 Add additional length checking, print unsigned lengths with %u. 2010-08-16 15:12:31 -07:00
Guy Harris
a914680c58 Print AppleTalk layer-3 network numbers as 16-bit unsigned decimal numbers.
Pick up from FreeBSD:

  revision 1.3
  date: 1996/09/11 06:18:26;  author: pst;  state: Exp;  lines: +9 -12
  branches:  1.3.2;
  Print appletalk layer 3 addresses as 16 bit unsigned decimal numbers,
  not two 8 bit values.  This conforms to industry standard.

  These changes have been sent back to LBL.

Inside AppleTalk(R), Second Edition speaks of node numbers as 16-bit.
2010-08-16 15:02:12 -07:00
Guy Harris
a81dd6aad4 Get rid of no-longer-valid comment.
We no longer guarantee alignment in any printer routine; all printers
must use the EXTRACT_ macros to extract integral quantities - and the
Appletalk printers now do so.
2010-08-16 10:43:28 -07:00
Guy Harris
2819ae6fae From Toshihiro Kanda, via FreeBSD: fix printing of address in AARP
replies (the relevant address is the source address, not the destination
address).
2009-07-25 10:37:47 -07:00
hannes
b0658cd234 add EIGRP support for Appletalk, display cosmetics to better indicate that we are dissecting Appletalk frames 2004-05-01 09:41:50 +00:00
guy
bbc1cfa669 Have the configure script arrange that the Makefile define _U_
appropriately, and that GNUmakefile and the MSVC++ project file define
it apppriately, as we do with libpcap, rather than defining it in
"interface.h".

Undo the rcsid-shuffling and addition of extra #includes, as we no
longer need to arrange that "interface.h" be included before using _U_
in an RCS ID or copyright.
2003-11-16 09:36:07 +00:00
guy
3824a6c041 From Neil Spring:
use "_U_" in the definitions of "rcsid[]", to eliminate
	complaints about those variables being unused;

	move the definitions after the include of "interface.h", or add
	an include of "interface.h", so that "_U_" is defined.

Include "config.h" before including "tcpdump-stdinc.h" in
"missing/datalinks.c".
2003-11-15 00:39:12 +00:00
guy
4bec97f457 Hoist a bunch of stuff that should be done by all if_print routines into
tcpdump.c.  Have if_print routines return the length of the link-layer
header, so that the common code knows how to skip the link-layer header
when printing the packet in hex/ASCII.
2002-12-19 09:39:10 +00:00
guy
fcc82f451d The "__attribute__((packed))" tag on structures causes some files not to
compile with Sun C, as "interface.h" isn't being included before the
structures are being declared.

Furthermore, in the files that Sun C *can* compile, it doesn't cause Sun
C to generate code that's safe with unaligned accesses, as
"__attribute__" is defined as a do-nothing macro with compilers that
don't support it.

Therefore, we get rid of that tag on the structures to which it was
added, and instead use "EXTRACT_16BIT()" and "EXTRACT_32BIT()" to fetch
16-bit and 32-bit big-endian quantities from packets.  We also fix some
other references to multi-byte quantities to get rid of code that tries
to do unaligned loads on platforms that don't support them.

We also throw in a hack that makes those macros use
"__attribute__((packed))" on structures containing only one 16-bit or
32-bit integer to get the compiler to generate unaligned-safe code
rather than doing it by hand.  (GCC on SPARC produces the same code that
doing it by hand does; I don't know if GCC on any other big-endian
strict-alignment processor generates better code for that case.  On
little-endian processors, as "ntohs()" and "ntohl()" might be functions,
that might actually produce worse code.)

Fix some places to use "%u" rather than "%d" to print unsigned
quantities.
2002-12-11 07:13:49 +00:00
itojun
10afb02ac8 put __attribute__((packed)) to packet headers. s/u_short/u_int16_t/ and so
forth while i'm here
2002-11-09 17:19:16 +00:00
itojun
9fb628d4cd remove buffer move in LBL_ALIGN case, which does more bad things than good things.
(if there's unaligned access, they must be converted to EXTRACT_xx)
2002-10-18 04:40:02 +00:00
guy
c422d3ab0f Get rid of the "-Wno-unused" flag, and fix up most of the
unused-parameter problems reported by GCC.  Add an _U_ tag to label
parameters as unused if the function is called through a pointer (so
that you can't change its signature by removing parameters) or if there
are unused parameters only because the function isn't complete.

Add some additional bounds checks the necessity for which was revealed
while cleaning up unused-parameter problems.

Make some routines static.

"lcp_print()", defined in "print-lcp.c", isn't called anywhere -
"print-ppp.c" has the code to dissect LCP.  Get rid of "print-lcp.c".
2002-09-05 21:25:34 +00:00
guy
79877e90f4 Get rid of some unnecessary includes (<time.h>, <netdb.h>, and <ctype.h>
are included by <tcpdump-stdinc.h>, so we don't have to include them
explicitly; <errno.h> isn't needed by print routines).
2002-08-06 04:42:04 +00:00
risso
3d932490b8 Added support for Win32, based on WinPcap. 2002-08-01 08:52:55 +00:00
guy
d47c1a036a Check for a too-small NBP length before subtracting the header size
(from OpenBSD's "print-atalk.c").
2002-02-05 10:03:34 +00:00
itojun
4069c74e12 indent 2001-11-15 08:23:12 +00:00
fenner
c672f00276 Eliminate some unused parameters.
Use const more.
Use EXTRACT_* macros more.
Use TCHECK* more.
Use tok2str() to replace some home-grown workalikes.
smb:
 - Get rid of private types, use tcpdump-defined types
 - Rename fdata and fdata1 to smb_fdata and smb_fdata1 to avoid conflict
   with IRIX library function.
2001-09-17 21:57:50 +00:00
guy
432b66a272 Patch from Chris Jepeway <jepeway@blasted-heath.com> to not dereference
misaligned pointers in the EtherTalk DDP printer on platforms that can't
handle misaligned addresses.
2001-07-18 09:19:47 +00:00
guy
176a3e4986 Put the infodelay wrapping into the remaining "XXX_if_print()" routines.
Split the Cisco HDLC printer into "chdlc_if_print()", which does the
stuff expected of a low-level print routine (printing the time stamp,
printing the final newline, doing the infodelay stuff) and
"chdlc_print()", which doesn't do that stuff.  This lets us clean up
"ppp_hdlc_if_print()" a bit - it can just print the time stamp at the
beginning, and do the infodelay stuff at the end, without having to
treat Cisco HDLC specially by skipping the time stamp printing.  (This
also ensures that the time stamp is always printed, which wasn't the
case before.)

Print the missing final newline in "pppoe_if_print()".
2001-07-05 18:54:13 +00:00
guy
159600ced5 Support for LocalTalk hardware, from Uns Lider <unslider@miranda.org>. 2001-06-18 08:52:51 +00:00
guy
84018cc541 Patch from Pekka Savola <pekkas@netcore.fi> to get rid of "savestr()"
(which doesn't actually seem to be significantly more efficient than
"strdup()", at least not to the extent that it makes any difference to
"tcpdump"), modified to use the BSD "strdup()", rather than the old
"savestr()", on platforms that lack "strdup()".
2001-01-20 07:22:20 +00:00
guy
692590f38c The packets inside IPTalk are just LLAP packets, so call the routine to
print them "llap_print()" (as per NetBSD), not "iptalk_print()".
2000-10-30 06:22:14 +00:00