Commit Graph

30 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 6c01a97497 You can't rely on "proto_tree_add_item()" returning a non-null pointer,
so you can't rely on getting the length of an FT_UINT_STRING item by
calling "proto_tree_add_item()" and fetching the item length from the
item.  Get the length of the string explicitly, and advance the offset
by the length of the string plus the length of the length field.

svn path=/trunk/; revision=9658
2004-01-13 21:49:52 +00:00
Guy Harris ad6d84c254 Note in a comment that "dissect_asp_reply_get_status()" might be
dissecting AFP server status - other servers might have different status
formats.

In "dissect_asp_reply_get_status()", put the UTF-8 server name into a
tree, with the length and name in the tree as separate items, and fetch
the length into a 16-bit variable (as it's a 16-bit length in the
packet), as is done in "dissect_dsi_reply_get_status()".  (XXX - should
that just be done with an FT_UINT_STRING field, as is done for other
strings?)

Use "tvb_get_string()" to fetch the UTF-8 server name, and set the
length and name from the values we fetched, in both of those routines.

For FT_UINT_STRING fields in "dissect_asp_reply_get_status()" and
"dissect_dsi_reply_get_status()", don't fetch the length separately -
just use the value filled in by "proto_tree_add_item()" (now that a
"proto_item" is no longer opaque, we can do that).  That means we don't
have a problem with overflows of the 8-bit "len" variable if the length
is 255.

svn path=/trunk/; revision=9567
2004-01-06 02:20:32 +00:00
Guy Harris c468938693 From Didier Gautheron: check packet format in get_dsi_pdu_len.
svn path=/trunk/; revision=9202
2003-12-08 20:36:59 +00:00
Guy Harris ff8f930fe3 From Didier Gautheron: more getserverinfo decoding.
svn path=/trunk/; revision=7459
2003-04-15 05:45:02 +00:00
Guy Harris 5b99f89521 From Didier Gautheron: better AFP 3.x dissector.
svn path=/trunk/; revision=6449
2002-10-17 22:38:19 +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 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 ae88c45ef0 From Joerg Mayer: make a pile of stuff not used outside one source file
static, and add a new "packet-data.h" to declare "proto_data".

Display escape sequences in octal in the IAPP dissector, as is now done
in the RADIUS dissector.

svn path=/trunk/; revision=5441
2002-05-10 23:20:38 +00:00
Guy Harris 904ecac64a From Didier Gautheron:
DSI and ASP updates to better handle addresses in replies.

	Dissect DSI "open session" and "attention" messages.

svn path=/trunk/; revision=5420
2002-05-08 23:46:34 +00:00
Guy Harris eb70c97a9b Make a "tcp_dissect_pdus()" with the standard loop for a TCP segment,
extracting PDUs from it and possibly doing reassembly.  Make the COPS,
DNS, DSI, Gryphon, and SCCP dissectors use it.

Add "set_actual_length()", "tcp_dissect_pdus()",
"decode_boolean_bitfield()", "decode_numeric_bitfield()", and
"decode_enumerated_bitfield()" to the list of routines available to
dissectors on platforms where routines in the main program aren't
available to dynamically-loaded code.

Declare routines in "to_str.h" as "extern"; as I remember, that's
necessary to allow the "decode_XXX_bitfield()" routines declared therein
to be made available to plugins as per the above.

Note that new exported routines should be added to the end of the table
if that's the only change being made to the table.

Create a new "plugin_api_decls.h" header file, used to declare both the
"p_" variables and the "p_" structure members in the routine-exporting
mechanism; this reduces the number of places you have to change to
change the list of exported routines.

svn path=/trunk/; revision=5394
2002-05-05 00:16:38 +00:00
Guy Harris 04ad5f17ea From Didier Gautheron:
afp :
	more calls.
    asp :
	move release transaction to atp.
	dissect asp call.
	fix a bug with transaction handling (conversation +tid are not
	enough as key ).
    atp :
	deal with one packet transaction without ATP_EOM.
    dsi:
	safeguard against overflow for unreassembled packet.
	more flags decoded.

Update the "packet-atalk.c" comment to reflect all the protocols in it.

svn path=/trunk/; revision=5376
2002-05-03 21:25:43 +00:00
Guy Harris 87b66571c5 Get rid of an unused argument.
svn path=/trunk/; revision=5326
2002-05-01 07:07:09 +00:00
Guy Harris 2d7f732677 From Didier Gautheron:
more calls supported in AFP;

	ATP desegmentation;

	show the name for NBP function 1 (broadcast request);

	"get status" reply for DSI.

svn path=/trunk/; revision=5316
2002-04-30 22:05:33 +00:00
Guy Harris 8c7276ba62 Put the error code/data offset field into the protocol tree as a data
offset on requests, and as an error code on replies, regardless of the
value.

svn path=/trunk/; revision=5277
2002-04-28 22:10:00 +00:00
Guy Harris 640a5e494a Pass even zero-length DSI and ASP "command" messages to the AFP
dissector, so it can show them as replies.

Put the command code into the protocol tree for replies.

Fix some additional AFP function names to match the names in the AFP
spec.

svn path=/trunk/; revision=5275
2002-04-28 21:53:31 +00:00
Guy Harris a8dd5ff42a Updates from Didier Gautheron:
More calls, more fields, and other updates, for AFP.

	Decode the error code for DSI.

Also, have separate fields for the code field in DSI when it's a data
offset and when it's an error code.

svn path=/trunk/; revision=5270
2002-04-28 19:21:39 +00:00
Guy Harris 9469b47866 ATP, ASP, and AFP support, from Didier Gautheron.
svn path=/trunk/; revision=5254
2002-04-25 23:58:02 +00:00
Guy Harris 6718d0fe05 Add support for DSI packet reassembly.
svn path=/trunk/; revision=5222
2002-04-22 08:50:49 +00:00
Guy Harris 46a89d60f5 From Didier Gautheron: make the "code" field an signed decimal number.
svn path=/trunk/; revision=5161
2002-04-14 22:56:02 +00:00
Guy Harris eb2d6593dc Replace a bunch of "tvb_length()" and "tvb_length_remaining()" calls in
arguments to "proto_tree_add_text()", and to "proto_tree_add_XXX()" calls
that add FT_NONE or FT_PROTO items to the protocol tree, with -1.

Replace some calls to "tvb_length()" or "tvb_length_remaining()" with
calls to "tvb_reported_length()" and "tvb_reported_length_remaining()",
as those give the actual length of the data in the packet, not just the
data that happened to be captured.

svn path=/trunk/; revision=4605
2002-01-24 09:20:54 +00:00
Guy Harris ee5ca25d31 Include files from the "epan" directory and subdirectories thereof with
"epan/..." pathnames, so as to avoid collisions with header files in any
of the directories in which we look (e.g., "proto.h", as some other
package has its own "proto.h" file which it installs in the top-level
include directory).

Don't add "-I" flags to search "epan", as that's no longer necessary
(and we want includes of "epan" headers to fail if the "epan/" is left
out, so that we don't re-introduce includes lacking "epan/").

svn path=/trunk/; revision=4586
2002-01-21 07:37:49 +00:00
Guy Harris 23319ff023 Move the pointer to the "column_info" structure in the "frame_data"
structure to the "packet_info" structure; only stuff that's permanently
stored with each frame should be in the "frame_data" structure, and the
"column_info" structure is not guaranteed to hold the column values for
that frame at all times - it was only in the "frame_data" structure so
that it could be passed to dissectors, and, as all dissectors are now
passed a pointer to a "packet_info" structure, it could just as well be
put in the "packet_info" structure.

That saves memory, by shrinking the "frame_data" structure (there's one
of those per frame), and also lets us clean up the code a bit.

svn path=/trunk/; revision=4370
2001-12-10 00:26:21 +00:00
Guy Harris bced8711f6 Make "dissector_add()", "dissector_delete()", and "dissector_change()"
take a dissector handle as an argument, rather than a pointer to a
dissector function and a protocol ID.  Associate dissector handles with
dissector table entries.

svn path=/trunk/; revision=4308
2001-12-03 04:00:26 +00:00
Guy Harris 07b2709f8a Change "conversation_set_dissector()" to take a dissector handle, rather
than a pointer to a dissector function, as an argument.

This means that the conversation dissector is called through
"call_dissector()", so the dissector itself doesn't have to worry about
checking whether the protocol is enabled or setting
"pinfo->current_proto", so get rid of the code that does that in
conversation dissectors.  Also, make the conversation dissectors static.

Get rid of some direct calls to dissectors; replace them with calls
through handles, and, again, get rid of code to check whether a protocol
is enabled and set "pinfo->current_proto" where that code isn't needed.
Make those dissectors static if they aren't already static.

Add a routine "create_dissector_handle()" to create a dissector handle
without registering it by name, if the dissector isn't used outside the
module in which it's defined.

svn path=/trunk/; revision=4281
2001-11-27 07:13:32 +00:00
Ed Warnicke fcd5b352af Moved from using dissect_data() to using call_dissector()
svn path=/trunk/; revision=4269
2001-11-26 04:52:51 +00:00
Guy Harris 3388bde488 Instead of having a single datum attached to a conversation, have a list
of protocol-id-plus-datum pairs, so that multiple protocols can attach
information to the same conversation.

Dissectors that attach information to a conversation should not assume
that if they find a conversation it has one of its data attached to it;
the conversation might've been created by another dissector.

svn path=/trunk/; revision=3901
2001-09-03 10:33:12 +00:00
Guy Harris 8412393197 From Joerg Mayer: explicitly fill in all members of a
"header_field_info" structure, including the ones that are later set by
the routines to register fields.

svn path=/trunk/; revision=3561
2001-06-18 02:18:27 +00:00
Guy Harris 8743489efa Appletalk Data Stream Interface (used by AFP-over-TCP) support, from
Randy McEoin.

svn path=/trunk/; revision=3446
2001-05-24 20:25:25 +00:00