aboutsummaryrefslogtreecommitdiffstats
path: root/epan/tvbuff.c
AgeCommit message (Collapse)AuthorFilesLines
2019-12-26Find the line ending using tvb_find_line_end().Guy Harris1-6/+6
tvb_find_line_end(), unlike a tvb_find_guint8() looking for an LF, returns a length that *doesn't* include the line ending, *regardless* of whether the line ends with CR-LF or just LF, so the query string we extract is just the query, without any of the line ending. Update some comments while we're at it to note that the "next_offset" pointer argument to tvb_find_line_end() and tvb_find_line_end_unquoted() can be NULL, in which case the offset *past* the line ending isn't returned. (We pass tvb_find_line_end() NULL in the aforementioned call, because, in that particular case, we don't care about the next line.) Change-Id: I1c9746e32c61a79f8cb636d577a2e14a07ecab17 Reviewed-on: https://code.wireshark.org/review/35566 Petri-Dish: Guy Harris <guy@alum.mit.edu> Tested-by: Petri Dish Buildbot Reviewed-by: Guy Harris <guy@alum.mit.edu>
2019-09-05kafka: Cleanup to use "native" APIs.Michael Mann1-1/+16
Add "native" support for the "zig-zag" version of a varint in proto.[ch] and tvbuff.[ch]. Convert the use of varint in the KAFKA dissector to use the (new) "native" API. Ping-Bug: 15988 Change-Id: Ia83569203877df8c780f4f182916ed6327d0ec6c Reviewed-on: https://code.wireshark.org/review/34386 Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-07-26HTTPS (almost) everywhere.Guy Harris1-1/+1
Change all wireshark.org URLs to use https. Fix some broken links while we're at it. Change-Id: I161bf8eeca43b8027605acea666032da86f5ea1c Reviewed-on: https://code.wireshark.org/review/34089 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2019-07-24Add a routine to fetch raw bytes into a fixed-length buffer as a string.Guy Harris1-0/+32
That's what the remaining calls to tvb_get_nstringz() and tvb_get_nstringz0() are being used to do, even though those routines were not intended for that purpose - the calls are extracting from a text protcool, meaning that the strings are *not* null-terminate in the packet. Strings - even null-terminated ones - should, in almost all cases, be extracted by tvb_get_string_enc() or routines that call it, so that an encoding is specified. In the few cases where we're fetching strings only to be compared to ASCII constants, or to parse as numbers, we can get away with this. Change-Id: I29f0532902c4ade2207de7f06db69c32eafd4132 Reviewed-on: https://code.wireshark.org/review/34072 Petri-Dish: Guy Harris <guy@alum.mit.edu> Tested-by: Petri Dish Buildbot Reviewed-by: Guy Harris <guy@alum.mit.edu>
2019-07-15Add support for the ISO 646 "Basic code table" encoding.Guy Harris1-0/+44
The "Basic code table" in ISO 646 is mostly ASCII, but some code points either 1) have more than one glyph that can be assigned to them or 2) have no glyph assigned to them. National versions choose one of the two glyphs for the code points in group 1) and assign specific glyphs to the code points in group 2); the International Reference Version assigns the same glyphs to those code points as does ASCII. For the "Basic code table" encoding, we map the code points in groups 1) and 2) to a REPLACEMENT CHARACTER; additional encodings can be added for the national versions. Add ENC_ISO_646_IRV (International Reference Version) as an alias for ENC_ASCII. Expand some comments, and add some comments, while we're at it. Change-Id: I4f1b5e426ec193775e919731c5cae1224dc65115 Reviewed-on: https://code.wireshark.org/review/33941 Petri-Dish: Guy Harris <guy@alum.mit.edu> Tested-by: Petri Dish Buildbot Reviewed-by: Guy Harris <guy@alum.mit.edu>
2019-07-15Add support for code pages 855 and 856 for FT_STRINGZ strings.Guy Harris1-2/+10
Clean up some comments while we're at it. Change-Id: I0cd014bf1d1e7dc740eac1721d5466377938655f Reviewed-on: https://code.wireshark.org/review/33939 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2019-05-25Add Windows code page 1252.Guy Harris1-0/+12
While we're at it, add the Euro to code page 1251, expand the comments for 1250 and 1251 and some DOS code pages, and add support for code page 1251 to tvb_get_stringz_enc(). Change-Id: I053d58f87cac26ad7c109e2f1cd8807ffec0622d Reviewed-on: https://code.wireshark.org/review/33342 Petri-Dish: Guy Harris <guy@alum.mit.edu> Tested-by: Petri Dish Buildbot Reviewed-by: Guy Harris <guy@alum.mit.edu>
2019-01-24tvbuff: Fix RFC 822 and 1123 date parsing with non-English localesPeter Wu1-13/+50
Avoid relying on strptime to parse the day of week (%a) and month name (%b) since these are locale-dependent. Fixes test suite failures with tvb.lua and LC_ALL=nl_NL.UTF-8. Additionally it will now reject four-digit years when using ENC_RFC_822 as that requires two digit years. The only user of this API seems to be the Lua tests though, so this should not make much of a difference. Bug: 15437 Change-Id: I75436b93faab23869794d9756b9c3ce6128dd1f4 Reviewed-on: https://code.wireshark.org/review/31698 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2019-01-04add encoding windows 1251, cp855, cp866kanidef1-0/+12
Change-Id: I0e8507cf63d89942167ca579ef304bc3d679346e Reviewed-on: https://code.wireshark.org/review/31316 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-12-09Add tvb_get_token_lenMichael Mann1-0/+67
This is intended to be a replacement for get_token_len (from strutil.h) when its used on a tvb. It should be a little safer and remove the need for a dissector to use tvb_get_ptr. Change-Id: Ib2d4a79718b6fba4eb9acc0129b13be6c8199a43 Reviewed-on: https://code.wireshark.org/review/30892 Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-10-21Add tvb_ascii_isprint APIMichael Mann1-0/+11
This allows dissectors to check if a portion of the tvb is an ascii string while hiding the use of tvb_get_ptr. Change-Id: Iaec7559dcfdefb8a5ae23e099ced45e90e611f8f Reviewed-on: https://code.wireshark.org/review/30291 Petri-Dish: Anders Broman <a.broman58@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-09-27tvb: gracefully handle reading 0 bytes from an empty bufferPeter Wu1-1/+9
proto_tree_add_item with a zero length argument could end up calling tvb_get_ptr to retrieve the (empty) backing buffer. This empty tvb was possibly the result of bad reassembly, but let's gracefully handle it to avoid a dissector exception. Call trace for the original exception (only present on the first pass): proto_report_dissector_bug (format=0x7ffffffecea0 "") at epan/proto.c:1368 ensure_contiguous_no_exception (tvb=0x6060001a5460, offset=0, length=0, pexception=0x7ffffffed060) at epan/tvbuff.c:775 ensure_contiguous (tvb=0x6060001a5460, offset=0, length=0) at epan/tvbuff.c:785 tvb_get_ptr (tvb=0x6060001a5460, offset=0, length=0) at epan/tvbuff.c:906 subset_get_ptr (tvb=0x607000194b90, abs_offset=0, abs_length=0) at epan/tvbuff_subset.c:58 ensure_contiguous_no_exception (tvb=0x607000194b90, offset=0, length=0, pexception=0x7ffffffed3c0) at epan/tvbuff.c:773 ensure_contiguous (tvb=0x607000194b90, offset=0, length=0) at epan/tvbuff.c:785 tvb_get_ptr (tvb=0x607000194b90, offset=0, length=0) at epan/tvbuff.c:906 proto_tree_set_bytes_tvb (fi=0x608000535ca0, tvb=0x607000194b90, offset=0, length=0) at epan/proto.c:3862 proto_tree_new_item (new_fi=0x608000535ca0, tree=0x604000543150, tvb=0x607000194b90, start=0, length=0, encoding=0) at epan/proto.c:2318 proto_tree_add_item_new (tree=0x604000543150, hfinfo=0x7ffff30e91f8, tvb=0x607000194b90, start=0, length=0, encoding=0) at epan/proto.c:3381 proto_tree_add_item (tree=0x604000543150, hfindex=65120, tvb=0x607000194b90, start=0, length=0, encoding=0) at epan/proto.c:3391 dissect_body_data (tree=0x604000543150, pinfo=0x614000000a58, tvb=0x607000194b90, start=0, length=0, encoding=0) at epan/dissectors/packet-http2.c:1974 Change-Id: Icfae83d61ddcc9e26f16eab7f6e0e84e2f0d73ac Reviewed-on: https://code.wireshark.org/review/29851 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-08-06tvbuff: add assertion to tvb_skip_wsp_return().Dario Lombardo1-2/+6
Minor indentation fixes. Change-Id: I0b22b1b247efc4f1db535eb1f7cb7e99c3637ba0 Reviewed-on: https://code.wireshark.org/review/28981 Reviewed-by: Dario Lombardo <lomato@gmail.com> Petri-Dish: Dario Lombardo <lomato@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2018-05-14tvbuff: make tvb_bytes_exist fail with negative valuesPeter Wu1-0/+7
tvb_generic_clone_offset_len uses tvb_bytes_exist to check that the requested tvb data is actually available. It did not expect negative values, that would result in an overly large memory allocation. Bug: 14678 Change-Id: Ie80095a381e55ca5dbbd5c9d835243549d0b212e Link: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=7179 Reviewed-on: https://code.wireshark.org/review/27526 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot Reviewed-by: Peter Wu <peter@lekensteyn.nl> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-04-21More 'abs_offset' initialisation needed for gcc 4.8.5 (Leap 42.3)Martin Mathieson1-4/+4
Change-Id: I1f2b797ade7d92596b5b42469e3161b6e373830b Reviewed-on: https://code.wireshark.org/review/27070 Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-04-20tvbuff: fix compilation with gcc-4.Dario Lombardo1-1/+1
../epan/tvbuff.c: In function 'tvb_new_octet_aligned': ../epan/tvbuff.c:274:26: error: 'abs_offset' may be used uninitialized in this function [-Werror=maybe-uninitialized] *rem_len = tvb->length - *offset_ptr; ^ ../epan/tvbuff.c:486:8: note: 'abs_offset' was declared here guint abs_offset, rem_length; ^ ../epan/tvbuff.c: In function 'tvb_find_line_end': ../epan/tvbuff.c:274:26: error: 'abs_offset' may be used uninitialized in this function [-Werror=maybe-uninitialized] *rem_len = tvb->length - *offset_ptr; ^ ../epan/tvbuff.c:486:8: note: 'abs_offset' was declared here guint abs_offset, rem_length; ^ ../epan/tvbuff.c: In function 'tvb_find_line_end_unquoted': ../epan/tvbuff.c:274:26: error: 'abs_offset' may be used uninitialized in this function [-Werror=maybe-uninitialized] *rem_len = tvb->length - *offset_ptr; ^ ../epan/tvbuff.c:486:8: note: 'abs_offset' was declared here guint abs_offset, rem_length; Change-Id: Iba9fe31ac5fcf604d65bbf3bceef0c09004c1b6c Reviewed-on: https://code.wireshark.org/review/27050 Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-04-20Handle subset tvbuffs where the length goes past the end of the parent.Guy Harris1-56/+123
Add a "contained length" to tvbuffs. For non-subset tvbuffs, that's the same as the reported length. For a subset tvbuff, that's the amount of the reported data that was actually present in the "contained data" of the parent tvbuff. This is unaffected by the *captured* length of any tvbuff; that differs from the contained length only if the capture was cut short by a snapshot length. If a reference is within the reported data, but not within the contained data, a ContainedBoundsError exception is thrown. This exception represents a protocol error, rather than a reference past the captured data in the packet; we treat it as such. Change-Id: Ide87f81238eaeb89b3093f54a87bf7f715485af5 Reviewed-on: https://code.wireshark.org/review/27039 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-04-10Add, and use, "fetch signed value" for lengths < 40 bits.Guy Harris1-20/+139
Add 8-bit, 16-bit, 24-bit, and 32-bit "fetch signed value" routines, and use them rather than casting the result of the 8/16/24/32-bit "fetch unsigned value" routines to a signed type (which, BTW, isn't sufficient for 24-bit values, so this appears to fix a bug in epan/dissectors/packet-zbee-zcl.c). Use numbers rather than sizeof()s in various tvb_get_ routines. Change-Id: I0e48a57fac9f70fe42de815c3fa915f1592548bd Reviewed-on: https://code.wireshark.org/review/26844 Petri-Dish: Guy Harris <guy@alum.mit.edu> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-03-13Get rid of TestBigEndian and AC_C_BIGENDIAN.Gerald Combs1-2/+2
Get rid of CMake's TestBigEndian and Autotools' AC_C_BIGENDIAN checks in favor of G_BYTE_ORDER. We use G_BYTE_ORDER elsewhere and TestBigEndian is noticeably slow on Windows. Change-Id: Idc1326294db9cbee8f6b6b11c2028fc4d19acbf0 Reviewed-on: https://code.wireshark.org/review/26462 Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot Reviewed-by: Gerald Combs <gerald@wireshark.org>
2018-02-08epan: use SPDX indentifiers.Dario Lombardo1-13/+1
Skipping dissectors dir for now. Change-Id: I717b66bfbc7cc81b83f8c2cbc011fcad643796aa Reviewed-on: https://code.wireshark.org/review/25694 Petri-Dish: Dario Lombardo <lomato@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-01-02Add ENC_VARINT_QUICAlexis La Goutte1-9/+34
Used to support variable length in QUIC protocol Bug: 13881 Change-Id: Ia274b1530152376c5fb4e364fc4cf5ab246be1b3 Reviewed-on: https://code.wireshark.org/review/24990 Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Craig Jackson <cejackson51@gmail.com> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2017-10-26Add a ws_in6_addr typedef for struct e_in6_addr.Guy Harris1-1/+1
That allows a parallel typedef of ws_in4_addr for guint32. Change-Id: I03b230247065e0e3840eb87635315a8e523ef562 Reviewed-on: https://code.wireshark.org/review/24073 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2017-10-09Add ENC_VARINT_PROTOBUFMichael Mann1-0/+20
Encoding of integer datatypes of Protocol buffers https://developers.google.cn/protocol-buffers/docs/encoding Change-Id: I9f6d65ddca099c15c0634984e9394131f98d35a9 Reviewed-on: https://code.wireshark.org/review/23813 Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-04-07simplify the description of tvb_memeql()Martin Kaiser1-2/+3
Make the description simpler than the code (hopefully). Change-Id: Iaede1a6eb18e25e379b719f9b66ecbef0c00ea63 Reviewed-on: https://code.wireshark.org/review/20956 Reviewed-by: Martin Kaiser <wireshark@kaiser.cx> Petri-Dish: Martin Kaiser <wireshark@kaiser.cx> Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-01-31format_text_wmem -> format_textMichael Mann1-2/+2
All cases of the "original" format_text have been handled to add the proper wmem allocator scope. Remove the "original" format_text and replace it with one that has a wmem allocator as a parameter. Change-Id: I278b93bcb4a17ff396413b75cd332f5fc2666719 Reviewed-on: https://code.wireshark.org/review/19884 Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-01-31Have tvb_format_text use wmem_packet_scope() memory.Michael Mann1-3/+4
It's only use is in dissectors or other tree creation APIs (where packet scope is valid), so have it use format_text_wmem with wmem_packet_scope(). Change-Id: I1f34e284a870c9844c6b27f4ae08a1e7efe54098 Reviewed-on: https://code.wireshark.org/review/19883 Reviewed-by: Michael Mann <mmann78@netscape.net> Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2017-01-31Have tvb_format_stringzpad use wmem_packet_scope() memory.Michael Mann1-3/+4
It's only use is in dissectors, so have it use format_text_wmem with wmem_packet_scope(). Change-Id: I22121324fd47aee32174b65104458ad2ef329bd7 Reviewed-on: https://code.wireshark.org/review/19856 Reviewed-by: Peter Wu <peter@lekensteyn.nl> Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-01-30Have format_text_wsp use wmem allocated memory.Michael Mann1-4/+4
format_text_wsp is fed into by tvb_format_text_wsp and tvb_format_stringzpad_wsp so those functions need to add a wmem allocated parameter as well. Most of the changes came from tvb_format_text_wsp and tvb_format_stringzpad_wsp being changed more so than format_text_wsp. Change-Id: I52214ca107016f0e96371a9a8430aa89336f91d7 Reviewed-on: https://code.wireshark.org/review/19851 Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-01-13Decode TBCD strings in GSM MAP as per the GSM MAP spec.Guy Harris1-2/+2
Hex digits 0xa through 0xe are '*', '#', 'a', 'b', and 'c', respectively. Constify the dgt_set_t argument to tvb_bcd_dig_to_wmem_packet_str(), while we're at it. Bug: 13316 Change-Id: I7586f35d23fd262453779d99946e7ccad4b6ffab Reviewed-on: https://code.wireshark.org/review/19620 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2017-01-10Rename tvb_new_subset() to tvb_new_subset_length_caplen().Guy Harris1-1/+1
This emphasizes that there is no such thing as *the* routine to construct a subset tvbuff; you need to choose one of tvb_new_subset_remaining() (if you want a new tvbuff that contains everything past a certain point in an existing tvbuff), tvb_new_subset_length() (if you want a subset that contains everything past a certain point, for some number of bytes, in an existing tvbuff), and tvb_new_subset_length_caplen() (for all other cases). Many of the calls to tvb_new_subset_length_caplen() should really be calling one of the other routines; that's the next step. (This also makes it easier to find the calls that need fixing.) Change-Id: Ieb3d676d8cda535451c119487d7cd3b559221f2b Reviewed-on: https://code.wireshark.org/review/19597 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-12-12Rename non-EBCDIC-specific routines.Guy Harris1-8/+8
Those routines can handle any single-byte character set whose characters map to characters in the Basic Multilingual Plane; it could be used for extended ASCII, but we have another routine for that, mapping only characters with code points > 0x7f, so we just say "nonascii" rather than "ebcdic". Change-Id: I3d55b5d58e3e7ab08f3dfbfdb57a0301a30e71d4 Reviewed-on: https://code.wireshark.org/review/19214 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-12-12Fix handling of EBCDIC string fields.Guy Harris1-13/+33
Have a routine that takes a 256-element translation table and uses it to map various flavors of EBCDIC to Unicode. Have separate translation tables for "common" EBCDIC (everything that's the same in all EBCDIC code pages that include the original EBCDIC characters) and EBCDIC code page 037. Add ENC_EBCDIC_CP037 for code page 037. Change-Id: Ia882b3c0abef9e30eb54cd47396e6fa0d6342044 Reviewed-on: https://code.wireshark.org/review/19212 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-11-11[tvbuff] Fix tvb_find_guint16() searched_bytes is fromAndersBroman1-2/+2
start_offset(offset) and the while loop should be on searched_bytes. Change-Id: I62343f7cb04f9110f773ba1ada8dbcbfbd262861 Reviewed-on: https://code.wireshark.org/review/18741 Petri-Dish: Anders Broman <a.broman58@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2016-10-22Add T.61 character set supportPascal Quantin1-0/+31
Bug: 13032 Change-Id: I6bf2cc2c43a6262d899a304df6576d9831115966 Reviewed-on: https://code.wireshark.org/review/18350 Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-10-22More checks for localtime() and gmtime() returning NULL.Guy Harris1-3/+10
And some comments in the case where we're converting the result of time() - if your machine's idea of time predates January 1, 1970, 00:00:00 UTC, it'll crash on Windows, but that's not a case where a *file* can cause the problem due either to a bad file time stamp or bad time stamps in the file. Change-Id: I837a438e4b875dd8c4f3ec2137df7a16ee4e9498 Reviewed-on: https://code.wireshark.org/review/18369 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-10-08add tvb_find_guint16() utilityFrancesco Fondelli1-0/+42
Change-Id: I75c0165948325c2e50918706d8a821411761727b Signed-off-by: Francesco Fondelli <francesco.fondelli@gmail.com> Reviewed-on: https://code.wireshark.org/review/17734 Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-06-02clean up some comments in tvb_find_line_end()Martin Kaiser1-8/+7
Change-Id: I9025b479b31e3cc6f8108a163bf00d81008fd737 Reviewed-on: https://code.wireshark.org/review/15632 Reviewed-by: Anders Broman <a.broman58@gmail.com>
2016-02-19Prevent inproper use of negative valueJaap Keuter1-2/+2
Coverity rightfully complains about inproper use of negative value. maxlength special value '-1' should be handled appropriately. Change-Id: Ie1818121e39fa668094d012980016444ca868e6e Reviewed-on: https://code.wireshark.org/review/13978 Reviewed-by: João Valverde <j@v6e.pt> Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-01-17Fix build [-Werror=maybe-uninitialized]João Valverde1-13/+13
Found building with GCC 5.3.0 and CFLAGS="-g -Og". Change-Id: I5bc29b6e91cc98332a513c9d03b02d2f6906608d Reviewed-on: https://code.wireshark.org/review/13362 Reviewed-by: João Valverde <j@v6e.pt> Petri-Dish: João Valverde <j@v6e.pt> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2016-01-07Remove constness from bytestring_to_str() [-Wcast-qual]João Valverde1-1/+1
Change-Id: I7f942787dfdc4f76dd0ad5111d1eb528b20f0ba9 Reviewed-on: https://code.wireshark.org/review/13011 Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com> Reviewed-by: João Valverde <j@v6e.pt>
2015-12-02Only check for the last nibble being 0x0f.Guy Harris1-1/+8
That's what my_dgt_tbcd_unpack() did; do the same thing here. Change-Id: Ia68c6ba652c748bd2661fd6eda736e880f414dc5 Reviewed-on: https://code.wireshark.org/review/12359 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-08-04tvb_new_octet_aligned() should return both the captured and reportedAndersBroman1-1/+1
length set to datalen in the returned tvb. Change-Id: Ie6649a285a9fa4a0564e29ce18ec9459b8da2541 Reviewed-on: https://code.wireshark.org/review/9861 Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-02-21Remove tvb_ from the names of wsutil mempbrk routines.Guy Harris1-14/+14
Routines that don't take a tvbuff as an argument shouldn't have tvb_ in the name. Change-Id: I3550256551e30b3f329cbbfca71ef27c727d29c0 Reviewed-on: https://code.wireshark.org/review/7302 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-02-12Fix crash at startup in SSE4.2 code when running a 32 bits Windows buildPascal Quantin1-2/+2
There is no guarantee that a g_malloc'ed memory block will be aligned on a 128 bits boundary Instead use a static variable definition (at the cost of exposing the HAVE_SSE4_2 compilation flag in ws_mempbrk.h) Change-Id: I661bf479a9d458d64c96bafc940c519d29a4780b Reviewed-on: https://code.wireshark.org/review/7070 Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com> Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
2015-02-11Combine SSE and pre-compiled patterns for faster pbrkHadriel Kaplan1-28/+28
This combines the SSE4.2 instructions usage, with pre-compiled pattern searching usage, for a faster pbrk search method. Testing against large files of HTTP and SIP, there is about a 5% performance improvement by using pre-"compiled" patterns for guint8_pbrk() instead of passing it the search string and having it build the match array every time. Similar to regular expressions, "compiling" the pattern match array in advance only once and using the "compiled" patterns for the searches is faster than compiling it every time. Change-Id: Ifcbc14a6c93f32d15663a10d974bacdca5119a8e Ping-Bug: 10798 Reviewed-on: https://code.wireshark.org/review/6990 Petri-Dish: Hadriel Kaplan <hadrielk@yahoo.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-01-07tvb_bytes_to_ep_str -> tvb_bytes_to_strMichael Mann1-10/+1
Change-Id: I79c613cbdd8dc939dd4c29ebc477fb6eefd5bfc4 Reviewed-on: https://code.wireshark.org/review/6371 Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-01-07tvb_bytes_to_ep_str_punct -> tvb_bytes_to_str_punctMichael Mann1-2/+2
Also change bytestring_to_str to match bytes_to_ep_str_punct functionality (limiting byte string size) Change-Id: Idb958c7f0c203d103629469302b81fa922714f7e Reviewed-on: https://code.wireshark.org/review/6369 Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-01-04Make all Lua code use wmem not ememHadriel Kaplan1-0/+9
Changed all remaining code in wslua that was using emem, to use wmem or simpler methods. Bug: 9927 Change-Id: I3d19a770e0fd77d996bdb6b61a76a722cc2bcd55 Reviewed-on: https://code.wireshark.org/review/6109 Petri-Dish: Michael Mann <mmann78@netscape.net> Reviewed-by: Hadriel Kaplan <hadrielk@yahoo.com> Petri-Dish: Hadriel Kaplan <hadrielk@yahoo.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-01-02tvb: implement endianness-paramterized gettersEvan Huus1-3/+111
e.g. tvb_get_guint16(tvb, offset, ENC_LITTLE_ENDIAN) Change-Id: Iea02fd59b13678aca741d028fb1f66f334447498 Reviewed-on: https://code.wireshark.org/review/6191 Reviewed-by: Michael Mann <mmann78@netscape.net> Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Evan Huus <eapache@gmail.com>
2014-09-25reassembly: fix when fragment cut off by snapshotEvan Huus1-1/+4
Also add an assertion to tvb_generic_clone_offset_len so that it throws an error *before* allocating memory, as otherwise that memory is leaked. Bug: 10474 Change-Id: I5036cefac16841914a59670c64979cf599bf7969 Reviewed-on: https://code.wireshark.org/review/4234 Petri-Dish: Evan Huus <eapache@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Evan Huus <eapache@gmail.com>