Commit Graph

107 Commits

Author SHA1 Message Date
Anders Broman e5f48395f1 Move the routines tvb_skip_wsp() to tvbuff.c
svn path=/trunk/; revision=23818
2007-12-09 17:41:16 +00:00
Guy Harris 9c89cdaaa3 strcasecmp(), strncasecmp(), g_strcasecmp(), and g_strncasecmp() delenda
est.  Use g_ascii_strcasecmp() and g_ascii_strncasecmp(), and supply our
own versions if they're missing from GLib (as is the case with GLib
1.x).

In the code to build the list of named fields for Diameter, don't use
g_strdown(); do our own g_ascii_-style upper-case to lower-case mapping
in the hash function and use g_ascii_strcasecmp() in the compare
function.

We do this because there is no guarantee that toupper(), tolower(), and
functions that use them will, for example, map between "I" and "i" in
all locales; in Turkish locales, for example, there are, in both
upper case and lower case, versions of "i" with and without a dot, and
the upper-case version of "i" is "I"-with-a-dot and the lower-case
version of "I" is "i"-without-a-dot.  This causes strings that should
match not to match.

This finishes fixing bug 2010 - an earlier checkin prevented the crash
(as there are other ways to produce the same crash, e.g. a bogus
dictionary.xml file), but didn't fix the case-insensitive string matching.

svn path=/trunk/; revision=23623
2007-11-27 18:52:51 +00:00
Anders Broman d24d657f75 Add {} to some IF statements.
svn path=/trunk/; revision=23468
2007-11-16 09:00:14 +00:00
Anders Broman 1143ab41b1 Apply yet another set of the optimization patches:
- Use a fast path for the most common use of tvb_get_xxx functions:
offset is >= 0 and tvb->real_data is set (this one is always true).
- match_strval() is a linear search, put the most common protocols
TCP/UDP/RDP first.
- fix gtk1 g_strlcat declaration Use g_strlcat

svn path=/trunk/; revision=23285
2007-10-27 14:44:29 +00:00
Guy Harris 0300ebc04a Get rid of unused variables.
Wrap 64-bit constants in G_GINT64_CONSTANT(), so they get the
appropriate suffix appended so the compiler knows they're 64 bits.

svn path=/trunk/; revision=21832
2007-05-19 03:45:39 +00:00
Anders Broman b688f9154a Split tvb_get_bits64 into tvb_get_bits8 tvb_get_bits16 tvb_get_bits32 and tvb_get_bits64
and use them in proto_tree_add_bits_ret_val().

svn path=/trunk/; revision=21828
2007-05-18 16:46:35 +00:00
Martin Mathieson 7510f41080 Fix proto_tree_add_bits_ret_val() (as now used by FP dissector).
Note that FP uses this function in a limited way, but this fixes problems seen.

svn path=/trunk/; revision=21727
2007-05-08 17:17:51 +00:00
Guy Harris ed652180e6 NULL is a pointer value; routines returning integral values shouldn't
return NULL.

svn path=/trunk/; revision=21613
2007-04-28 22:01:27 +00:00
Guy Harris b19c9f63e9 Make tvb_memdup(), like ep_tvb_memdup(), return a "void *".
svn path=/trunk/; revision=21610
2007-04-28 21:06:15 +00:00
Anders Broman 43bb2aea51 Add:
proto_tree_add_bits_ret_val()
tvb_get_bits()
And modify
proto_tree_add_bits() not to return a value.
little endian is not yet implemented.

svn path=/trunk/; revision=21607
2007-04-28 12:13:25 +00:00
Guy Harris 8ff20a50ce Fix definition of tvb_memcpy() to match declaration.
svn path=/trunk/; revision=21555
2007-04-24 17:12:29 +00:00
Guy Harris 6f8cee8acd "memcpy()" takes void *'s as arguments and returns a void *; have
tvb_memcpy() be similar, to avoid unnecessarily alignment warnings.

Do the same with "ep_tvb_memdup()".

svn path=/trunk/; revision=21554
2007-04-24 11:54:18 +00:00
Guy Harris adcccbcdee More const cleanup.
svn path=/trunk/; revision=21535
2007-04-23 18:18:08 +00:00
Guy Harris 56fcbf41be The "needles" argument of guint8_pbrk() needs to be const, as that's
what's passed to it.

svn path=/trunk/; revision=21531
2007-04-23 17:37:36 +00:00
Guy Harris 1bc049906a Add some GCC warnings to the standard set, and add some others to the
--enable-extra-gcc-checks set.

If we turn on -pedantic, try turning on -Wno-long-long as well, so that
it's not *so* pedantic that it rejects the 64-bit integral data types
that we explicitly require.

Constify a bunch of stuff, and make some other changes, to get rid of
warnings.

Clean up some indentation.

svn path=/trunk/; revision=21526
2007-04-23 10:59:26 +00:00
Gerald Combs 9022de04b1 Make our tvb exists before we try to dereference it. Fixes some of the
current fuzz errors.

svn path=/trunk/; revision=18665
2006-07-05 18:47:21 +00:00
Anders Broman 764e3ac167 New rutine tvb_format_text_wsp() which will change "whiite space" characters to space
before output.

svn path=/trunk/; revision=18519
2006-06-19 15:53:03 +00:00
Ronnie Sahlberg 89f022b12b name change
svn path=/trunk/; revision=18197
2006-05-21 05:12:17 +00:00
Tomas Kukosa bb39c4f7a6 add guid-utils.h to Makefile.common
remove unused variables from tvbuff.c

svn path=/trunk/; revision=17567
2006-03-10 12:57:22 +00:00
Tomas Kukosa 923855bb20 new FT_GUID handling - big/little endian supported
svn path=/trunk/; revision=17566
2006-03-10 11:58:22 +00:00
Guy Harris 6f38a35500 Add some inflateEnd() calls to free up stuff associated with a stream
before freeing the stream; bug 659 mentioned one of them, but there
appear to be others.

svn path=/trunk/; revision=16973
2006-01-07 03:36:37 +00:00
Ulf Lamping 3fd9edbf10 as tvb functions are frequently used by a lot of dissectors, use DISSECTOR_ASSERT() like instead of g_assert throughout tvbuff, so a malicious dissector won't crash Ethereal (at least at the ways we can detect it)
of course this won't catch e.g. NULL pointers, but far better than nothing ...

svn path=/trunk/; revision=15980
2005-09-23 18:27:30 +00:00
Ulf Lamping 76b09b1fee assert that tvb is not NULL
svn path=/trunk/; revision=15858
2005-09-18 20:11:54 +00:00
Guy Harris 25c4bc9379 Replace tvb_memcpy() calls that extract IPv4 addresses into a guint32,
and that extract IPv6 addresses into a "struct e_in6_addr", with
tvb_get_ipv4() and tvb_get_ipv6() calls - except for some that we
remove, by using proto_tree_add_item(), rather than replacing.

Have epan/tvbuff.h include epan/ipv6-utils.h, to define "struct
e_in6_addr" (not necessary to declare the tvbuff routines, but including
it there means "struct e_in6_addr" is guaranteed to be defined before
those declarations, so we don't get compiler complaints if we define it
*after* those declarations).

svn path=/trunk/; revision=15758
2005-09-11 21:25:37 +00:00
Guy Harris 266e1a3491 Add "tvb_get_ipv4()" and "tvb_get_ipv6()" addresses, to fetch IPv4 and
IPv6 addresses.  Use "tvb_get_ipv4()" in the WINS Replication dissector,
so that it gets the right answer on little-endian *AND* big-endian
machines.

svn path=/trunk/; revision=15753
2005-09-10 19:43:41 +00:00
Ulf Lamping 495eb1b788 snprintf -> g_snprintf
svn path=/trunk/; revision=15398
2005-08-17 23:10:28 +00:00
Ronnie Sahlberg 9599cf9e3b add new function tvb_get_ephemeral_stringz()
svn path=/trunk/; revision=15273
2005-08-10 14:25:59 +00:00
Ronnie Sahlberg b4441e6748 rename ep_tvb_fake_unicode() to tvb_get_ephemeral_faked_unicode() and update the README file.
svn path=/trunk/; revision=15271
2005-08-10 13:56:34 +00:00
Ronnie Sahlberg ec3ab9ec3e rename ep_tvb_get_string() to tvb_get_ephemeral_string() asnd update the documentation in README.developer
svn path=/trunk/; revision=15270
2005-08-10 13:41:13 +00:00
Ronnie Sahlberg 93c4543207 add an ep version of tvb_fake_unicode()
svn path=/trunk/; revision=15128
2005-07-28 08:55:11 +00:00
Luis Ontanon c5688891a1 new functions:
ep_tvb_memdup()
ep_alloc0()
ep_strsplit()

add all of the ep_ allocators to libethereal.def

svn path=/trunk/; revision=15100
2005-07-26 18:32:12 +00:00
Ronnie Sahlberg 0d385f730f add
ep_tvb_get_string
that acts the same as tvb_get_string   but the buffer returned need not be freed.



svn path=/trunk/; revision=15024
2005-07-24 01:56:01 +00:00
Gerald Combs c9bc1edd92 When trying to handle gzip-compressed data, don't seek past the end of our
compressed data buffer.  Fixes bug 288.

svn path=/trunk/; revision=14981
2005-07-21 21:40:57 +00:00
Gerald Combs 618b8887dc Use tvb_ensure_bytes_exist() in tvb_get_string() instead of throwing an
exception ourselves.  Fixes bug 130.

svn path=/trunk/; revision=14220
2005-04-28 18:07:40 +00:00
Gerald Combs 131ab36a32 In tvb_get_string(), throw an exception if our length is less than zero.
Add a message block length check to the AIM dissector.

svn path=/trunk/; revision=13955
2005-03-28 15:55:47 +00:00
Guy Harris 5474a467a2 From Chris Maynard: free up the z_stream we've allocated before failure
returns.  (The error returns shouldn't happen in practice, as the GLib
memory allocators never return a null pointer, they just abort the
program, but if we're going to be checking for failure and returning, we
should do the right thing anyway.)

svn path=/trunk/; revision=12957
2005-01-05 10:19:36 +00:00
Guy Harris a0de9d34c7 Add a "tvb_bytes_to_str_punct()" routine, which wraps
"bytes_to_str_punct()", and use it instead of extracting the bytes and
formatting them by hand.

svn path=/trunk/; revision=12876
2004-12-30 23:47:52 +00:00
Guy Harris a3f3ea6dbe From Charles Levert: in "tvb_fake_unicode()", convert non-ASCII
characters to '.'.

svn path=/trunk/; revision=12515
2004-11-12 10:26:56 +00:00
Guy Harris c68f62210f Add "tvb_get_ntoh64()" and "tvb_get_letoh64()" routines to fetch 64-bit
integers.

Make FT_INT64 and FT_UINT64 add numerical values, rather than byte-array
values, to the protocol tree, and add routines to add specified 64-bit
integer values to the protocol tree.

Use those routines in the RSVP dissector.

svn path=/trunk/; revision=11796
2004-08-22 00:31:58 +00:00
Guy Harris cb0506f41b Most developers have only 10 fingers, not 16. :-)
svn path=/trunk/; revision=11581
2004-08-02 18:58:19 +00:00
Olivier Biot c3ccccf2b6 From Kelly Byrd: fix tvb_uncompress() for GZIP encoded content.
svn path=/trunk/; revision=11579
2004-08-02 09:15:58 +00:00
Guy Harris 8a8b883450 Set the svn:eol-style property on all text files to "native", so that
they have LF at the end of the line on UN*X and CR/LF on Windows;
hopefully this means that if a CR/LF version is checked in on Windows,
the CRs will be stripped so that they show up only when checked out on
Windows, not on UN*X.

svn path=/trunk/; revision=11400
2004-07-18 00:24:25 +00:00
Olivier Biot 687f3af0f2 From Jerry Talkington: speed up tvb_uncompress() by increasing the minimal
and default uncompression buffer.

svn path=/trunk/; revision=10839
2004-05-10 22:14:07 +00:00
Olivier Biot 463597f54a Memory management of tvb_uncompress() needs tvb_set_free_cb().
svn path=/trunk/; revision=10817
2004-05-07 18:15:24 +00:00
Olivier Biot 77449b1085 From Kendy Kutzner: a char should be compared with '\0', not NULL.
svn path=/trunk/; revision=10806
2004-05-06 17:40:52 +00:00
Olivier Biot 659ac78357 From Jerry Talkington:
- Helper functions for uncompressing compressed tvbuffers.

	- Compressed content coding dissection in HTTP.

svn path=/trunk/; revision=10799
2004-05-05 06:55:09 +00:00
Guy Harris 834543d7c7 Use "tvb_format_text()" to display strings, so we handle non-printable
characters.

Some strings appear to be null-padded; add a "tvb_format_stringzpad()"
routine to handle them, so that we don't show the padding characters as
"\000".

svn path=/trunk/; revision=10461
2004-03-23 18:06:29 +00:00
Guy Harris d09c4c4eab Constify a bunch of stuff.
svn path=/trunk/; revision=10106
2004-02-19 05:19:10 +00:00
Guy Harris 87b219554e Make "tvb_strneql()" take a "gchar *" rather than a "guint8 *" as the
string argument.

Add some casts to squelch compiler warnings.

svn path=/trunk/; revision=9951
2004-02-01 21:30:17 +00:00
Jörg Mayer 38faa0f27b packet-dcerpc-afs4int.c
svn path=/trunk/; revision=9938
2004-02-01 06:49:25 +00:00