aboutsummaryrefslogtreecommitdiffstats
path: root/epan/tvbuff.c
AgeCommit message (Collapse)AuthorFilesLines
2006-07-05Make our tvb exists before we try to dereference it. Fixes some of the Gerald Combs1-32/+35
current fuzz errors. svn path=/trunk/; revision=18665
2006-06-19New rutine tvb_format_text_wsp() which will change "whiite space" characters ↵Anders Broman1-0/+21
to space before output. svn path=/trunk/; revision=18519
2006-05-21name changeRonnie Sahlberg1-8/+8
svn path=/trunk/; revision=18197
2006-03-10add guid-utils.h to Makefile.commonTomas Kukosa1-4/+0
remove unused variables from tvbuff.c svn path=/trunk/; revision=17567
2006-03-10new FT_GUID handling - big/little endian supportedTomas Kukosa1-0/+35
svn path=/trunk/; revision=17566
2006-01-07Add some inflateEnd() calls to free up stuff associated with a streamGuy Harris1-1/+7
before freeing the stream; bug 659 mentioned one of them, but there appear to be others. svn path=/trunk/; revision=16973
2005-09-23as tvb functions are frequently used by a lot of dissectors, use ↵Ulf Lamping1-55/+55
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-18assert that tvb is not NULLUlf Lamping1-0/+1
svn path=/trunk/; revision=15858
2005-09-11Replace tvb_memcpy() calls that extract IPv4 addresses into a guint32,Guy Harris1-1/+0
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-10Add "tvb_get_ipv4()" and "tvb_get_ipv6()" addresses, to fetch IPv4 andGuy Harris1-0/+25
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-08-17snprintf -> g_snprintfUlf Lamping1-2/+2
svn path=/trunk/; revision=15398
2005-08-10add new function tvb_get_ephemeral_stringz()Ronnie Sahlberg1-0/+26
svn path=/trunk/; revision=15273
2005-08-10rename ep_tvb_fake_unicode() to tvb_get_ephemeral_faked_unicode() and update ↵Ronnie Sahlberg1-6/+3
the README file. svn path=/trunk/; revision=15271
2005-08-10rename ep_tvb_get_string() to tvb_get_ephemeral_string() asnd update the ↵Ronnie Sahlberg1-1/+1
documentation in README.developer svn path=/trunk/; revision=15270
2005-07-28add an ep version of tvb_fake_unicode()Ronnie Sahlberg1-0/+38
svn path=/trunk/; revision=15128
2005-07-26new functions:Luis Ontanon1-2/+30
ep_tvb_memdup() ep_alloc0() ep_strsplit() add all of the ep_ allocators to libethereal.def svn path=/trunk/; revision=15100
2005-07-24addRonnie Sahlberg1-0/+32
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-21When trying to handle gzip-compressed data, don't seek past the end of our Gerald Combs1-0/+6
compressed data buffer. Fixes bug 288. svn path=/trunk/; revision=14981
2005-04-28Use tvb_ensure_bytes_exist() in tvb_get_string() instead of throwing an Gerald Combs1-2/+1
exception ourselves. Fixes bug 130. svn path=/trunk/; revision=14220
2005-03-28In tvb_get_string(), throw an exception if our length is less than zero.Gerald Combs1-2/+6
Add a message block length check to the AIM dissector. svn path=/trunk/; revision=13955
2005-01-05From Chris Maynard: free up the z_stream we've allocated before failureGuy Harris1-0/+2
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
2004-12-30Add a "tvb_bytes_to_str_punct()" routine, which wrapsGuy Harris1-0/+11
"bytes_to_str_punct()", and use it instead of extracting the bytes and formatting them by hand. svn path=/trunk/; revision=12876
2004-11-12From Charles Levert: in "tvb_fake_unicode()", convert non-ASCIIGuy Harris1-4/+4
characters to '.'. svn path=/trunk/; revision=12515
2004-08-22Add "tvb_get_ntoh64()" and "tvb_get_letoh64()" routines to fetch 64-bitGuy Harris1-0/+18
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-02Most developers have only 10 fingers, not 16. :-)Guy Harris1-3/+3
svn path=/trunk/; revision=11581
2004-08-02From Kelly Byrd: fix tvb_uncompress() for GZIP encoded content.Olivier Biot1-3/+3
svn path=/trunk/; revision=11579
2004-07-18Set the svn:eol-style property on all text files to "native", so thatGuy Harris1-1/+1
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-05-10From Jerry Talkington: speed up tvb_uncompress() by increasing the minimalOlivier Biot1-17/+69
and default uncompression buffer. svn path=/trunk/; revision=10839
2004-05-07Memory management of tvb_uncompress() needs tvb_set_free_cb().Olivier Biot1-1/+2
svn path=/trunk/; revision=10817
2004-05-06From Kendy Kutzner: a char should be compared with '\0', not NULL.Olivier Biot1-3/+3
svn path=/trunk/; revision=10806
2004-05-05From Jerry Talkington:Olivier Biot1-1/+244
- Helper functions for uncompressing compressed tvbuffers. - Compressed content coding dissection in HTTP. svn path=/trunk/; revision=10799
2004-03-23Use "tvb_format_text()" to display strings, so we handle non-printableGuy Harris1-1/+25
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-02-19Constify a bunch of stuff.Guy Harris1-25/+33
svn path=/trunk/; revision=10106
2004-02-01Make "tvb_strneql()" take a "gchar *" rather than a "guint8 *" as theGuy Harris1-6/+6
string argument. Add some casts to squelch compiler warnings. svn path=/trunk/; revision=9951
2004-02-01packet-dcerpc-afs4int.cJörg Mayer1-3/+3
svn path=/trunk/; revision=9938
2004-01-23Change return type of tvb_format_text from guint8* to gchar*.Jörg Mayer1-2/+2
Remove now unnecessary casts in two files. svn path=/trunk/; revision=9801
2003-12-24In "tvb_ensure_bytes_remaining()", throw ReportedBoundsError, notGuy Harris1-2/+2
BoundsError, if the offset is just past the end of the reported data (because we're ensuring that there actually *is* a byte there, and, even according to the reported length, it isn't). svn path=/trunk/; revision=9444
2003-12-23Have "tvb_ensure_length_remaining()" throw the appropriate exception ifGuy Harris1-1/+12
there's no data remaining - its callers largely depend on it doing so. That means that the BEEP dissector doesn't have to check for it returning 0. svn path=/trunk/; revision=9433
2003-12-03Replace two expensive macros with a much simpler mechanismRonnie Sahlberg1-14/+21
to prevent memory leaks due to exceptions. makes my tethereal testcase ~1% faster. svn path=/trunk/; revision=9153
2003-12-03performance updateRonnie Sahlberg1-11/+2
replace tvb_raw_offset() which is essentially a simple assignment and which is called a lot with a macro. this makes my tethereal testcase 2-3% faster. svn path=/trunk/; revision=9152
2003-12-02Move the definition of the tvbuff_t structure and friends to tvbuff.hRonnie Sahlberg1-68/+1
so that we can change tvb_get_ds_tvb() into a macro. This function was a single line assignment and was called a lot. This made tethereal ~2.5% faster in one testcase I use. svn path=/trunk/; revision=9141
2003-09-28"compute_offset_length()" must, if it returns FALSE, and "exception" isGuy Harris1-5/+5
non-null, set "*exception" to the appropriate exception - its callers rely on it. Now that it does that, there's no need for "check_offset_length()" to check for a length of -1, as "compute_offset_length()" does so, and therefore "check_offset_length_no_exception()" does so. svn path=/trunk/; revision=8562
2003-09-10Make tvb_find_tvb() return -1 if either tvb length is 0. Otherwise, anGerald Combs1-1/+5
assertion happens 'xxxx contains ""'. svn path=/trunk/; revision=8450
2003-08-27Add a "contains" operator for byte-strings, strings, and tvbuffs (protocols).Gilbert Ramirez1-1/+31
The search uses a naive approach; more work is required to add a Boyer-Moore Search algorithm. svn path=/trunk/; revision=8280
2003-08-08A bufsize of 0 makes no sense in either "tvb_get_nstringz()" orGuy Harris1-11/+8
"tvb_get_nstringz0()", as it means there's no room even for the terminating NUL; abort if "_tvb_get_nstringz()" is passed a bufsize of 0. Don't throw an exception in "tvb_get_nstringz0()" if "_tvb_get_nstringz()" returns 0 - that just means we have an empty string. svn path=/trunk/; revision=8150
2003-06-12Add new routines:Guy Harris1-10/+63
tvb_get_string() - takes a tvbuff, an offset, and a length as arguments, allocates a buffer big enough to hold a string with the specified number of bytes plus an added null terminator (i.e., length+1), copies the specified number of bytes from the tvbuff, at the specified offset, to that buffer and puts in a null terminator, and returns a pointer to that buffer (or throws an exception before allocating the buffer if that many bytes aren't available in the tvbuff); tvb_get_stringz() - takes a tvbuff, an offset, and a pointer to a "gint" as arguments, gets the size of the null-terminated string starting at the specified offset in the tvbuff (throwing an exception if the null terminator isn't found), allocates a buffer big enough to hold that string, copies the string to that buffer, and returns a pointer to that buffer and stores the length of the string (including the terminating null) in the variable pointed to by the "gint" pointer. Replace many pieces of code allocating a buffer and copying a string with calls to "tvb_get_string()" (for one thing, "tvb_get_string()" doesn't require you to remember that the argument to "tvb_get_nstringz0()" is the size of the buffer into which you're copying the string, which might be the length of the string to be copied *plus 1*). Don't use fixed-length buffers for null-terminated strings (even if the code that generates those packets has a #define to limit the length of the string). Use "tvb_get_stringz()", instead. In some cases where a value is fetched but is only used to pass an argument to a "proto_tree_add_XXX" routine, use "proto_tree_add_item()" instead. svn path=/trunk/; revision=7859
2003-06-09Fix "tvb_strneql()", "tvb_strncaseeql()", and "tvb_memeql()" not toGuy Harris1-6/+24
throw an exception if there aren't enough bytes in the tvbuff to compare. svn path=/trunk/; revision=7813
2003-06-04Use "tvb_ensure_bytes_exist()" to check, in "tvb_fake_unicode()", toGuy Harris1-7/+3
make sure we have the entire string, rather than fetching the last character. svn path=/trunk/; revision=7783
2003-05-19More tvb_get_nstringz0() fixes. Timo Sirainen pointed out that BadGerald Combs1-1/+7
Things can happen if we pass a zero buffer length to tvb_get_nstringz0(). Throw an exception if this happens. In various dissectors make sure the tvb_get_nstringz0()'s buffer length is greater than zero. svn path=/trunk/; revision=7688
2003-04-30Modify tvb_get_nstringz*() to behave more like snprintf(). Make changesGerald Combs1-26/+26
where necessary to reflect the new behavior. svn path=/trunk/; revision=7607