Commit Graph

149 Commits

Author SHA1 Message Date
Anders Broman 25af78517e Make tvb_pbrk_guint8() return the found needle.
svn path=/trunk/; revision=32144
2010-03-08 20:45:13 +00:00
Bill Meier 9d663d7081 Fix various gcc -Wshadow warnings.
svn path=/trunk/; revision=31720
2010-01-28 18:45:46 +00:00
Stig Bjørlykke bb5ef1c521 parent is not unused in tvb_child_uncompress().
svn path=/trunk/; revision=31658
2010-01-25 13:54:05 +00:00
Jaap Keuter 5dcaa2bec0 Make more output parameters optional.
svn path=/trunk/; revision=31059
2009-11-23 22:02:12 +00:00
Gerasimos Dimitriadis 9b36fc784e From yy:
About GSM system information type 2quater
Modified to use newly defined tvb_get_bits() in tvbuff.c
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=4219


svn path=/trunk/; revision=30962
2009-11-14 20:13:43 +00:00
Kovarththanan Rajaratnam dc265696a1 tvb_format_text() always returns a non NULL pointer so don't check return value for NULL pointer
svn path=/trunk/; revision=30821
2009-11-04 16:08:47 +00:00
Kovarththanan Rajaratnam 30cb2b9448 Add DISSECTOR_ASSERT() before dereferencing a possible NULL pointer
svn path=/trunk/; revision=30404
2009-10-08 15:01:25 +00:00
Kovarththanan Rajaratnam 7775703b1a Use g_new0() when allocating z_stream
svn path=/trunk/; revision=30277
2009-10-04 06:32:43 +00:00
Kovarththanan Rajaratnam 911b058d02 Use GLibs CLAMP(). The current inlined implementation seems to be wrong:
} else if (bufsiz > TVB_Z_MAX_BUFSIZ) {
		bufsiz = TVB_Z_MIN_BUFSIZ;
	}

This should probably have been 'bufsiz = TVB_Z_MAX_BUFSIZ;'

svn path=/trunk/; revision=30276
2009-10-04 06:28:50 +00:00
Kovarththanan Rajaratnam 19bf38ac52 Delay allocation of z_stream
svn path=/trunk/; revision=30275
2009-10-04 06:20:32 +00:00
Kovarththanan Rajaratnam 1703bfa464 g_malloc0() doesn't return NULL so remove NULL error paths
svn path=/trunk/; revision=30274
2009-10-04 06:12:31 +00:00
Kovarththanan Rajaratnam c285a1cd3a Remove 'type' formal parameter from tvb_new_with_subset()
svn path=/trunk/; revision=29988
2009-09-20 07:35:39 +00:00
Kovarththanan Rajaratnam b97cfa22fd offset_from_real_beginning() is only called with 0 as second argument, so remove the argument completely. It seems that the second argument only acts as an accumulator allowing offset_from_real_beginning() to call itself recursively. To be consistent offset_from_real_beginning() is renamed to tvb_offset_from_real_beginning().
svn path=/trunk/; revision=29844
2009-09-10 16:54:02 +00:00
Kovarththanan Rajaratnam fe6f8b92c7 Add a new function, tvb_new_subset_remaining(), which is a sligtly optimized version of tvb_new_subset(). The latter can be mapped to the former by tvb_new_subset(tvb, offset, -1 /* backing_length */, -1 /* reported_length */). We can disable some bounds checking because 'backing_length' and 'reported_length' are hardcoded to -1.
The current implementation of tvb_new_subset_remaining() only has the THROW_ON(reported_length < 1) check removed when compared to tvb_new_subset(). So there's room for improvement in this function. We should be able to disable some more (redundant) bounds checking.

svn path=/trunk/; revision=29445
2009-08-16 10:53:47 +00:00
Kovarththanan Rajaratnam c795851beb Remove unused parameters
svn path=/trunk/; revision=29444
2009-08-16 09:48:25 +00:00
Kovarththanan Rajaratnam 6cd59f3799 Remove the non-thread safe usage of 'last_tvb' variable in tvb_new_subset()
svn path=/trunk/; revision=29443
2009-08-16 09:18:17 +00:00
Kovarththanan Rajaratnam 998ee3a2e0 Make some of the check_XXX functions accept the length/reported length of the tvbuff as arguments instead the tvbuff. We'll need this feature in order to remove the non-thread usage of the 'last_tvb' variable in tvb_new_subset()
svn path=/trunk/; revision=29442
2009-08-16 08:18:17 +00:00
Kovarththanan Rajaratnam 01abc372e6 Remove a non thread-safe usage (useful when/if we ever support threading) of a static tvbuff in tvb_new_real_data(). The current version uses a static 'last_tvb' to keep track of the last allocated tvbuff. This is needed because some of the function we call can throw an exception. This patch improves this strategy by throwing an exception (if needed) before we try to allocate the tvbuff. This way we avoid a memleak _and_ we don't have to track the 'last_tvb' tvbuff.
svn path=/trunk/; revision=29441
2009-08-16 07:29:11 +00:00
Kovarththanan Rajaratnam aed905a6c9 Use the slice allocator if GLIB >= 2,10,0 as suggested by Anders Broman
svn path=/trunk/; revision=29434
2009-08-15 13:24:59 +00:00
Kovarththanan Rajaratnam 623db2e71e Add a missing DISSECTOR_ASSERT in tvb_init()
svn path=/trunk/; revision=29433
2009-08-15 12:41:24 +00:00
Kovarththanan Rajaratnam ef68d63745 Make mem chunk static
svn path=/trunk/; revision=29432
2009-08-15 12:29:25 +00:00
Kovarththanan Rajaratnam e1c5ffd553 (Trivial change) move ensure_contiguous() to reflect call hierarchy
svn path=/trunk/; revision=29382
2009-08-11 18:28:10 +00:00
Kovarththanan Rajaratnam 158827a5e7 Turn a comment in fast_ensure_contiguous() into a DISSECTOR_ASSERT() to make the implied requirement explicit.
svn path=/trunk/; revision=29381
2009-08-11 18:16:55 +00:00
Stig Bjørlykke 81c551ec59 Remove some "statement not reached" warnings.
svn path=/trunk/; revision=28691
2009-06-11 10:03:08 +00:00
Stig Bjørlykke a44cc2442d Fixed check for no_of_bits in tvb_get_bits16(), tvb_get_bits32() and
tvb_get_bits64().

svn path=/trunk/; revision=28658
2009-06-08 08:28:42 +00:00
Stig Bjørlykke d628c0a4cc Added tvb_format_stringzpad_wsp().
svn path=/trunk/; revision=28140
2009-04-24 08:08:37 +00:00
Guy Harris 8b7812db76 Reapply the change from revision 27946.
svn path=/trunk/; revision=27963
2009-04-05 17:24:06 +00:00
Gerald Combs 17ae564af8 Back out the previous change. As Guy pointed out, we might not want to
be so size_t-happy.

svn path=/trunk/; revision=27962
2009-04-05 16:26:16 +00:00
Gerald Combs 098eb5606f tvbuff.[ch]: Accept more size_t's.
packet-wcp.c: Add size_t casts.
packet-x11.c: Use string buffers.

svn path=/trunk/; revision=27959
2009-04-04 19:34:06 +00:00
Guy Harris 1f96f14083 Don't support a length of -1 meaning "to the end of the tvbuff" in
tvb_memcpy(); I changed the one tvb_memcpy() call that was explicitly
depending on that not to do so.  This is a small step towards getting
rid of the "-1 means to end of tvbuff" convention, support for which
requires us to do a bunch of extra checks where, for example, a protocol
has a 32-bit unsigned length field; it also gets rid of a warning about
comparing an unsigned value with a signed value.

svn path=/trunk/; revision=27946
2009-04-03 17:04:45 +00:00
Gerald Combs 342a836bba Make the "length" argument of the tvb_mem* functions a size_t since it's
not uncommon to pass them the result of pointer arithmetic. Add size_t
casts in other areas.

svn path=/trunk/; revision=27941
2009-04-03 15:30:38 +00:00
Anders Broman 4ba5d2f92b Add to new functions from the optimization patch:
tvb_child_uncompress()
tvb_new_child_real_data()

svn path=/trunk/; revision=27924
2009-04-01 16:22:51 +00:00
Stephen Fisher 1a71ec7c45 Introduce two new functions:
tvb_get_seasonal_string();
  tvb_get_seasonal_stringz();

.. which work the same as the ephemeral versions of the functions, but use
se_alloc() instead of ep_alloc().


svn path=/trunk/; revision=27868
2009-03-27 19:40:23 +00:00
Stig Bjørlykke 62f60df6b4 From Jakub Zawadzki (bug 3331):
g_free() is NULL safe, so we don't need check against it.

svn path=/trunk/; revision=27718
2009-03-13 22:06:48 +00:00
Jeff Morriss 73f7073540 Fix https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=2649 by adding some length checks to two while loops in tvb_uncompress()
svn path=/trunk/; revision=25677
2008-07-08 20:04:11 +00:00
Gerald Combs 8db852e950 Port over the composite tvbuff fixes from /trunk-1.0.
svn path=/trunk/; revision=25498
2008-06-20 20:33:38 +00:00
Jörg Mayer 944beafd70 Get rid of some unsued code: The warning causes a failure due to -Werror
svn path=/trunk/; revision=25028
2008-04-14 21:31:19 +00:00
Anders Broman 4073fa0deb From Michael McCartney:
patch for tvb_get_bits16 not to read past end of buffer
http://bugs.wireshark.org/bugzilla/show_bug.cgi?id=2439

svn path=/trunk/; revision=24942
2008-04-12 17:00:41 +00:00
Anders Broman 63c5c71cf8 Remove:
#ifdef NEED_G_ASCII_STRCASECMP_H
#include "g_ascii_strcasecmp.h"
#endif

svn path=/trunk/; revision=24859
2008-04-09 05:36:08 +00:00
Ashok Narayanan 7fe3f42d5a Fixed bug with tvb_get_bits64(); the mask array had one less "ff" than
it needs. This manifests itself in calls to tvb_get_bits64() and in
calls to proto_tree_add_bits_xxx() for >32 bits.



svn path=/trunk/; revision=24726
2008-03-25 18:53:17 +00:00
Stig Bjørlykke 6193d9d3c2 Add a inflateEnd() call to free up the stream in the re-init block.
svn path=/trunk/; revision=24559
2008-03-04 22:56:26 +00:00
Anders Broman 4d01fd05cb tvbuff.c - fix abug if reading last byte in tvb
Further H.264 decoding in SDP

svn path=/trunk/; revision=23847
2007-12-12 21:50:14 +00:00
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