Commit Graph

18 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 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
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 976fcf09d4 The mysterious two bytes were just the FCS. Use the length field from
the IP header as the reported length again, but make the actual length
be the minimum of the length of the tvbuff and the reported length, just
to keep from having a weird tvbuff that has more data than the packet
has.

svn path=/trunk/; revision=5876
2002-07-15 09:56:04 +00:00
Guy Harris 4ceeb56841 Make the reported length of the VJ-uncompressed tvbuff the reported
length of the data in the PPP packet, not the value from the IP header,
just in case there's extra crap at the end.  (That appears to be the
case in at least one pppdump capture filel; that's probably either a bug
in the version of pppdump that produced the capture or in the pppdump
reading code, but, until we fix that, if we can, let's at least get this
right, so that the reported length of the tvbuff won't be less than the
length unless that was the case for the tvbuff handed to us.)

svn path=/trunk/; revision=5868
2002-07-14 08:57:56 +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 134b903afa Dissect the headers of VJ compressed packets even if decompression is
turned off or we don't know the direction of the traffic.

svn path=/trunk/; revision=5522
2002-05-22 10:15:28 +00:00
Guy Harris bd8337321a Maintain separate "discard compressed frames" state per connection.
Put the array of connection states into the per-direction state
structure; its size is fixed, as the connection number field size is 1
byte.  Get rid of the "rslot_limit" member, as the number is fixed.

Get rid of the per-state "next" pointer, as it's unused.

Process uncompressed frames even if VJ decompression is turned off, and
even if the "discard compressed frames" flag is set on the connection,
as there's no decompression to do.

If the full IP and TCP header isn't available in an uncompressed frame,
discard subsequent compressed frames.

Only use the "discard compressed frames" flag on the first pass through
the capture; on subsequent passes, the presence of an "uncompressed
header" item attached to the frame indicates whether we could decompress
it or not (the "discard compressed frames" flag would merely indicate
the *last* state it had for that connection, which might not have been
the state at the time we saw that frame).

svn path=/trunk/; revision=5520
2002-05-22 09:49:28 +00:00
Guy Harris 44580a93ca Don't include the FCS in the tvbuff handed to "dissect_ppp_common()", so
that it's not included in the tvbuff handed to subdissectors.  Use that
tvbuff to compute the FCS.

Properly handle the FCS in frames that don't include all the captured
data.

In VJ-compressed packets, put the VJ compression information into the
protocol tree, and set the Protocol and Info columns, and don't worry
about the CRC - as per the above, it's no longer in the tvbuff (and
never *was* in the tvbuff in some cases).

Also, clean up some other stuff in the VJ dissector.

svn path=/trunk/; revision=5510
2002-05-20 00:56:30 +00:00
Guy Harris 1606d119fb Set the Info column for compressed and uncompressed TCP.
svn path=/trunk/; revision=5504
2002-05-18 21:19:48 +00:00
Guy Harris 64fe90a383 From Joerg Mayer: get rid of some unused variables and arguments.
Use "tvb_get_ntohs()" to fetch the checksum from a VJ compressed packet,
rather than doing the ntoh by hand.

svn path=/trunk/; revision=5163
2002-04-14 23:22:22 +00:00
Guy Harris 6a21dc7e44 Don't give tvbuffs names; instead, give data sources names, where a
"data source" has a name and a top-level tvbuff, and frames can have a
list of data sources associated with them.

Use the tvbuff pointer to determine which data source is the data source
for a given field; this means we don't have to worry about multiple data
sources with the same name - the only thing the name does is label the
notebook tab for the display of the data source, and label the hex dump
of the data source in print/Tethereal output.

Clean up a bunch of things discovered in the process of doing the above.

svn path=/trunk/; revision=4749
2002-02-18 01:08:44 +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 43caedd1f9 From Irfan Khan: don't use bitfields.
svn path=/trunk/; revision=4517
2002-01-10 22:07:49 +00:00
Guy Harris 49effaa0f1 Again, leave the SET_ADDRESS() stuff for IP to the IP dissector.
svn path=/trunk/; revision=4431
2001-12-20 06:32:19 +00:00
Guy Harris b34c47e4d2 Make the object attached to a frame for VJ decompression be a structure
containing a 4-byte offset and 128 bytes of data, rather than a 1-byte
offset and 128 bits of data, so that the data is aligned on a 4-byte
boundary and doesn't upset processors with strict alignment
requirements.

We don't free individual memory chunks containing those objects, so make
the memory chunk pool an "allocate-only" pool.

svn path=/trunk/; revision=4428
2001-12-19 22:39:59 +00:00
Guy Harris 3624071a79 Van Jacobson decompression support for PPP, from Irfan Khan.
svn path=/trunk/; revision=4427
2001-12-19 21:14:49 +00:00