Commit Graph

106 Commits

Author SHA1 Message Date
Guy Harris 857318d3b7 Use "tvb_get_string()" instead of allocating a (len+1)-sized buffer,
"tvb_memcpy()"ing to it, and putting in a null terminator;
"tvb_get_string()" will check whether all bytes of the string are
present before allocating the buffer, so that you don't leak memory if
the copy throws an exception, and don't crash if the length is absurdly
large.

Use "tvb_memdup()" instead of allocating a buffer and "tvb_memcpy()"ing
to it, so that an exception is thrown before you try to allocate the
buffer (for the same reasons as listed above).

Before allocating a buffer used when processing a chunk of data from a
packet, get a pointer to the chunk with "tvb_get_ptr()", or check that
the data is all there with "tvb_ensure_bytes_exist()", so that an
exception is thrown before you try to allocate the buffer (for the same
reasons as listed above).

Fix up the lengths of the tvbuff used when dissecting ONC RPC opaque data
with a particular dissector.

svn path=/trunk/; revision=10236
2004-02-25 09:31:07 +00:00
Guy Harris 4e8ec37ad8 From Pavel Kankovsky: deal with yet another gross non-standard 802.11
encapsulation by bridges - this one stuffs a complete Ethernet frame
into the payload of a data frame.

svn path=/trunk/; revision=10091
2004-02-18 07:56:42 +00:00
Guy Harris 2528c053ce Supply a pseudo-header for all 802.11 packets; add an "fcs_len" field to
it, similar to the Ethernet pseudo-header's "fcs_len" field, and use it
in the 802.11 dissector.

svn path=/trunk/; revision=9884
2004-01-27 08:06:12 +00:00
Gerald Combs d72750578b Pull most of bytes_from_unparsed() into a new routine,
hex_str_to_bytes().  Use the new routine to initialize any WEP keys we
have defined.  This has the side effect of fixing an overflow if the user
entered a long WEP key.

svn path=/trunk/; revision=9471
2003-12-29 04:07:06 +00:00
Guy Harris 1a347fc00f Do the special "if the first fragment we see is also the final fragment,
treat it as a reassembled frame" hack *only* for 802.11, as that's the
only protocol we know of that requires it.

svn path=/trunk/; revision=9367
2003-12-20 03:21:20 +00:00
Guy Harris 54b276060b From David Frascone: have an 802.11 dissector that byte-swaps the frame
control field, and have a preference in the LWAPP dissector to specify
whether to use it or the regular 802.11 dissector, as some hardware
sends out LWAPP-encapsulated 802.11 packets with a byte-swapped FC field.

svn path=/trunk/; revision=8534
2003-09-24 23:35:39 +00:00
Guy Harris 40bf435a5b Get rid of some unnecessary includes.
Instead of using "dissect_vendor_specific_ie()" to dissect the WPA key
data, turn the code to dissect a collection of 802.11 tagged parameters
into a routine, use that routine when dissecting 802.11 management
frames, and also use it to dissect the key data.

svn path=/trunk/; revision=8513
2003-09-23 02:35:59 +00:00
Guy Harris 8185dbe5d2 From Richie:
the units for output power are dBm, not dbi;

	decode multiple start channel/number of channels/output power
	combinations;

	display the output power as a signed value.

Additional change from Martijn Schipper to fix the display of the output
power.

Pass the tagged data value pointer to "dissect_vendor_specific_ie()".

Don't special-case unknown tag values - use "val_to_str()" even for
unknown tag values, and handle the value in the "default:" case.

svn path=/trunk/; revision=8501
2003-09-20 03:48:23 +00:00
Guy Harris e1b7f940c0 Give the tag number a value_string table, and have common code, rather
than tag-specific code, put it, and the tag length, into the protocol
tree.  Make those fields FT_UINT8, as they're one byte long.

Don't pass to "dissect_vendor_specific_ie()" variables whose names and
values are the same as global variables.

svn path=/trunk/; revision=8499
2003-09-20 03:20:17 +00:00
Guy Harris 8093f3ecff From Ritchie: dissect country information tag.
svn path=/trunk/; revision=8470
2003-09-15 18:40:53 +00:00
Guy Harris a224698042 Make "process_reassembled_data()" do the check for fragmentation not
being complete and for fragmentation being trivial (i.e., the packet in
question is both the first and last fragment).  Have its callers *not*
do that check - this lets "process_reassembled_data()" put in the
"Reassembled in" item for fragments other than the last fragment.

Add a "Reassembled in" field to TDS.

svn path=/trunk/; revision=8295
2003-08-28 04:19:29 +00:00
Guy Harris b73e8138a8 Make the CRC-32 routines take a tvbuff and a length as arguments.
Rename "crc32()" so as not to collide with the one in zlib; rename
"crc32_802()" to match.

svn path=/trunk/; revision=8268
2003-08-26 06:18:18 +00:00
Guy Harris f7e3062867 From Jesper Peterson:
Extract the FCS decoding section of the PPP_HDLC dissector to
	allow the CHDLC dissector to use the same routine.

	The ppp_options used for preferences has been renamed to
	fcs_options and exported via packet-ppp.h so CHDLC gets a
	separate (but identical) FCS preference.

	This means prefs.h has to be included before packet-ppp.h so a
	couple of ppp related files (packet-{gtp,null,raw,vj}.c) had
	their includes slightly re-arranged.

From me: make the PPP/CHDLC FCS code use "crc32()" to check the 32-bit
FCS.

svn path=/trunk/; revision=8266
2003-08-26 05:52:53 +00:00
Guy Harris 42fdef2ff4 Extract the CRC-32 code from the 802.11 dissector into a separate file,
and use it in the Ethernet dissector as well, to check the FCS in
Ethernet frames, if present.

svn path=/trunk/; revision=8265
2003-08-26 05:09:56 +00:00
Guy Harris 1867f2ff24 From Motonori Shindo:
parse the WEP keys every time they're changed, not just when we
	start up;

	make the description of the WEP keys in the preference more
	accurate.

svn path=/trunk/; revision=7922
2003-06-24 06:23:05 +00:00
Gerald Combs 96de41b6b2 From Lars Roland: Replace bcmp() with memcmp(), add a missing quote to the
NSIS definition file.

svn path=/trunk/; revision=7793
2003-06-05 22:10:49 +00:00
Gerald Combs 035e8c1cd2 From Jeff Liu: Add support for WPA (Wi-Fi Protected Access) key in EAPOL
frames and WPA IE in 802.11 beacon and probe response frames.

svn path=/trunk/; revision=7770
2003-06-03 01:20:14 +00:00
Guy Harris 2573a5527a From Laurent Rabret: use "g_free()", not "free()", to free stuff
allocated with "g_malloc()" and related GLib routines.

svn path=/trunk/; revision=7758
2003-05-28 22:40:19 +00:00
Guy Harris 181be03665 The last byte of "foo[N]" is "foo[N-1]", not "foo[N]".
svn path=/trunk/; revision=7740
2003-05-25 19:37:36 +00:00
Gerald Combs 356ddbd284 Fix instances where the return value of snprintf() was being checked for -1,
but not for <buf_size> or greater.  Discovered by Timo Sirainen.

svn path=/trunk/; revision=7731
2003-05-24 17:45:10 +00:00
Laurent Deniel 4e9e699536 Replace some unchecked malloc calls by g_malloc.
svn path=/trunk/; revision=7584
2003-04-27 20:57:58 +00:00
Guy Harris d359286841 Add a pointer to an hf_ value for a "reassembled_in" field (which can be
null) to the "fragment_items" structure, and don't pass that value into
"process_reassembled_data()", just have it use the value in the
"fragment_items" structure passed to it.

Make "process_reassembled_data()" capable of handling reassembly done by
"fragment_add_seq_check()", and use it in the ATP and 802.11 dissectors;
give them "reassembled_in" fields.  Make "process_reassembled_data()"
handle only the case of a completed reassembly (fd_head != NULL) so that
we can use it in those dissectors without gunking the code up too much.

svn path=/trunk/; revision=7513
2003-04-20 11:36:16 +00:00
Guy Harris cedc0334ec From Solomon Peachy: add support for the latest stuff defined in the
draft 7.1 of 802.11g, plus a few response codes defined in 802.11b.

svn path=/trunk/; revision=7392
2003-04-01 19:05:55 +00:00
Guy Harris 9db95664d1 When deciding whether we have enough data in a lower-level packet to
attempt reassembly of a higher-level packet that includes the
lower-level packet, use "tvb_bytes_exist()" to check whether all the
data that's to be included in the reassembly is available, rather than
by checking whether the packet is short.

Add some checks of that sort that were missing.

Use the reported length of the packet when doing reassembly.

Make the "iphdrlen" field of a "packet_info" structure be the length of
the IP header in bytes, not in 4-byte words.

svn path=/trunk/; revision=7274
2003-03-04 06:47:10 +00:00
Guy Harris 23ed899373 From Martijn Schipper: fix the tag for the 802.11g ERP Information field
to match draft 6.1 of the 802.11g spec.

svn path=/trunk/; revision=7168
2003-02-18 21:29:53 +00:00
Guy Harris 46ce1e6079 Make all the stuff in the capability fixed field in a management frame
2-byte bitfields, as the capability field is 2 bytes long.

svn path=/trunk/; revision=6980
2003-01-22 19:39:25 +00:00
Guy Harris 745fcf1971 From Jouni Malinen:
support for two new 802.11 elements used in the latest IEEE
	802.11g draft version: ERP Information and Extended Support
	Rates;

	two new capabilities flags.

svn path=/trunk/; revision=6978
2003-01-22 17:11:20 +00:00
Ronnie Sahlberg e4633bc783 Update reassemble.c/show_item and all callers to use FT_FRAMENUM for the list of packets corresponding to a reassembled pdu
svn path=/trunk/; revision=6807
2002-12-19 11:22:38 +00:00
Guy Harris 8ee4a65f76 From Solomon Peachy: support for new "wlancap" 802.11 extra-information
header.

Add overflow checks to "BYTES_ARE_IN_FRAME()", and cast all arguments to
unsigned values (negative values should never be passed) to squelch
compiler warnings.

svn path=/trunk/; revision=6567
2002-11-06 21:49:34 +00:00
Guy Harris 05c9a97091 From Chris Waters: put the "wlan.fc.fromds" and "wlan.fc.tods" fields
into the protocol tree.

svn path=/trunk/; revision=6524
2002-10-31 20:46:00 +00:00
Guy Harris 07d0032f1c Add a "fragment_add_seq_next()" to reassemble fragments that don't have
sequence numbers or offsets and are thus assumed to be received in order
with no duplicates or dropped fragments (e.g., for NetBIOS Frame, where
802.2 LLC guarantees in-order delivery to NetBIOS with no duplicates or
dropped fragments).

"show_fragment_tree()' and "show_fragment_seq_tree()" don't modify the
"fragment_items" to which the "fit" argument points, so make that
argument a "const fragment_items *".

Make all the "fragment_items" tables "static" (as they're not used
outside the modules defining them) and "const" (as they're not
modified).

Add support for reassembly of NetBIOS fragmented requests and responses.

Get rid of an unnecessary include of "packet-tr.c" in the NetBIOS
dissector, and make its table of dissection function pointers static.

Fix some typos in the AppleTalk and NetBIOS dissectors.

svn path=/trunk/; revision=6491
2002-10-24 06:17:36 +00:00
Guy Harris 1780e3e10b From Solomon Peachy: display "(correct)" or "(not verified)" for the WEP
ICV, depending on whether it was successfully verified or not.

svn path=/trunk/; revision=6464
2002-10-21 19:05:21 +00:00
Jörg Mayer 7c4176d868 Removed trailing whitespaces from .h and .c files using the
winapi_cleanup tool written by Patrik Stridvall for the wine
project.

svn path=/trunk/; revision=6117
2002-08-28 21:04:11 +00:00
Jörg Mayer 173fe5aef4 Replace the types from sys/types.h and netinet/in.h by their glib.h
equivalents for the toplevel directory. The removal of winsock2.h will
hopefully not cause any problems under MSVC++, as those files using
struct timeval still include wtap.h, which still includes winsock2.h.

svn path=/trunk/; revision=5932
2002-08-02 23:36:07 +00:00
Guy Harris 8751a85ac2 From Chris Waters: check 802.11 FCS if present.
svn path=/trunk/; revision=5918
2002-07-31 09:00:02 +00:00
Guy Harris 77fa06b899 From Joerg Mayer:
dftest.c:
	     Remove #if-0-ed includes

	packet-ieee80211.c, packet-wtls.c, packet-afp.c, packet-wsp.c,
        packet-wtp.c, ethereal_gen.py:
	     Remove redundant include varargs (already in snprintf.h,
	     and required only for snprintf.h)

	Remove unused include of snprintf.h from files not using
	"snprintf()".

svn path=/trunk/; revision=5889
2002-07-17 00:43:03 +00:00
Guy Harris 6ef2cc2b1f Fetch the WEP IV before building a subtree for the WEP parameters, so we
don't end up with an empty tree for the parameters.

Fetch the IV and key regardless of whether we're building a protocol
tree; that ensures that we know we have the IV/key before we try to
dissect stuff after it.

svn path=/trunk/; revision=5741
2002-06-22 23:11:36 +00:00
Guy Harris 91d306bb75 "uint" is defined on all platforms; use "guint" instead.
svn path=/trunk/; revision=5735
2002-06-22 10:24:35 +00:00
Guy Harris 19235a85de Fix to WEP decoding, from Solomon Peachy.
svn path=/trunk/; revision=5706
2002-06-19 17:57:23 +00:00
Guy Harris b67dba63e4 Fix some bugs in the dissection of WEP-encrypted frames.
Put the WEP header tree under the top-level 802.11 tree, rather than
putting it at the top level itself.

svn path=/trunk/; revision=5702
2002-06-19 09:18:45 +00:00
Guy Harris aca19eb102 From Solomon Peachy: do WEP decryption before reassembly.
Use "memset()" rather than "bzero()", as "memset()" is the official ANSI
C routine (and you get an error when compiling with MSVC++ if you use
"bzero()").

svn path=/trunk/; revision=5699
2002-06-18 20:17:17 +00:00
Guy Harris 5fdb6ae2f9 From Solomon Peachy: WEP cleanups, WEP decryption support and other
mangling of the 802.11 dissector, and optional processing of an FCS at
the end of the frame.

When dissecting the frame-type-dependent part of the header, dissect all
management frames (including ones with an invalid subtype) the same, and
dissect all data frames (including ones with an invalid subtype) the
same.

svn path=/trunk/; revision=5696
2002-06-18 08:38:19 +00:00
Guy Harris 4f9508837a Add "show_fragment_seq_tree()", which is like "show_fragment_tree()",
but for stuff reassembled with "fragment_add_seq()" or
"fragment_add_seq_check()".

Add a "fragment tag" string to the "fragment_items", so that packets
with fragmentation errors can be properly flagged as having "Illegal
fragments" or "Illegal segments" depending on the term used with the
protocol in question.

Make all the dissectors that can use "show_fragment_tree()" or
"show_fragment_seq_tree()", and don't already use them, do so.

svn path=/trunk/; revision=5644
2002-06-07 10:11:41 +00:00
Guy Harris 392a7dfc04 Get rid of the "data_src" member of the "frame_data" structure; put it
in the "packet_info" structure instead, as we don't need a pointer for
every single frame in the capture file, just for each frame for which we
currently have an open "epan_dissect_t".

svn path=/trunk/; revision=5614
2002-06-04 07:03:57 +00:00
Guy Harris 4401f1433f Don't pass "tvb_reported_length_remaining(tvb, offset)" as the fourth
argument to "tvb_new_subset()" - just use -1 if the subset tvbuff is to
run to the end of the parent tvbuff.

svn path=/trunk/; revision=5597
2002-05-30 01:56:55 +00:00
Guy Harris fedc54cc90 Fix an error in a blurb.
svn path=/trunk/; revision=5327
2002-05-01 07:21:19 +00:00
Guy Harris 8a5d5f9bde From Joerg Mayer: get rid of extra arguments to capture routines.
svn path=/trunk/; revision=5233
2002-04-24 06:03:34 +00:00
Guy Harris d215b73503 Get rid of some unused variables and arguments.
svn path=/trunk/; revision=5221
2002-04-22 08:14:12 +00:00
Guy Harris b2c11b5e13 Don't try to reassemble short frames - but do still pass them through at
least some of the reassembly mechanism, so we can deal with both bogus
and real last fragment (display the bogus ones as unfragmented frames,
treat the real ones as fragments).

svn path=/trunk/; revision=5186
2002-04-17 10:07:57 +00:00
Guy Harris 3cd4cd18c3 Fix up the handling of the "fragmented" flag in the "packet_info"
structure (make it match the way it's done in the IP dissector).

svn path=/trunk/; revision=5184
2002-04-17 09:34:09 +00:00