aboutsummaryrefslogtreecommitdiffstats
path: root/epan/tvbuff_composite.c
AgeCommit message (Collapse)AuthorFilesLines
2023-01-15Fix typoJiří Engelthaler1-1/+1
2022-02-25TVB composite: allow to append/prepend a NULL tvbUli Heilmeier1-14/+14
When the tvb which should be appended/prepended is a NULL we just leave the tvb_composite as it is. Related to #17890
2020-06-01composite_tvb: fix memory leak when tvb_composite_finalize is not calledPeter Wu1-13/+19
There is a window where the memory for the composite TVB can be leaked, namely between calling tvb_composite_new and tvb_composite_finalize. This can occur due to complex dissector logic (bug 16375) or due to exceptions preventing tvb_composite_finalize from being called. Fix this by attaching the composite TVB sooner to another TVB. Ideally tvb_composite_new is changed to receive the initial TVB as parameter, but that would change its API. While at it, remove a redundant NULL-pointer check and comment. The comment referring to a union was likely about avoiding the const-cast. Bug: 16375 Change-Id: Ic8c6d1da6fbd5ff9f16b1280af3aab23f9ed470d Reviewed-on: https://code.wireshark.org/review/37345 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot 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>
2018-10-12tvbuff_composite: fix buffer overflow due to wrong offset adjustmentPeter Wu1-5/+2
The tvb_offset method should return the offset of the buffer within the backing tvb (ds_tvb). The currently returned non-zero offset is valid for tvbuff_subset.c, but not for the composite TVB. The backing tvb is the tvb itself, so the offset should be zero (or "counter" for consistency with tvbuff_real.c and others). This bug is observable with the capture from the bug. In tshark, the data field in the PDML output has value "field length invalid!" and the position attribute ("pos") is too large. With the -V option it even crashes with a buffer overflow (read). In the GUI, the bytes tab shows range 3199-19642 even if the data source is only 16444 bytes while the selection should have been 0-16443. Bug: 14466 Change-Id: I01399ff500321dba262eb60b67c4cddb173b4679 Reviewed-on: https://code.wireshark.org/review/30124 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot 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-0/+2
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-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>
2016-11-13tvbuff_composite.c: fix composite_get_ptr when length is over 2 segmentsPascal Quantin1-2/+2
When storing a copy of the composite tvb in tvb->real_data, ensure to copy the full data and not only the length currently requested by the call to tvb_get_ptr() Change-Id: I6b42f3d46c4fba83fadf4d06f465c8d2486f4853 Reviewed-on: https://code.wireshark.org/review/18806 Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
2016-05-31Fix display of composite tvbs in GUIPascal Quantin1-2/+5
a composite tvb is the top-level data source tvb fix composite_get_ptr function Change-Id: Ibab58801a754fd88fb86b9a13804bccf2ad51c7a Reviewed-on: https://code.wireshark.org/review/15643 Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com> Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-04-22tvbuff_composite.c: do not recompute abs_lengthPascal Quantin1-5/+0
abs_length is already computed by the caller of composite_get_ptr (ensure_contiguous_no_exception). No need to do the work another time Change-Id: I93edd6d405b2d5afe99dc7c781ecea4b395ef7bd Reviewed-on: https://code.wireshark.org/review/15053 Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com> 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>
2016-04-22Do not mix wmem and glib allocatorsPascal Quantin1-1/+7
Change-Id: I0e845668a1b9dbec93ea920a8585ecfe60f001d1 Reviewed-on: https://code.wireshark.org/review/15044 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>
2015-06-24Remove deprecated tvb_length callsEvan Huus1-1/+1
Trust that the files in epan/ immediately (not dissectors) know what they're doing so just blindly convert them to captured length. Change-Id: I872f7d58b2e15ae82c75fd56f4873996fbc97be7 Reviewed-on: https://code.wireshark.org/review/9083 Reviewed-by: Evan Huus <eapache@gmail.com>
2015-01-18Remove some apparently-unnecessary includes of emem.h.Guy Harris1-2/+0
Change-Id: Ib7d1b587b439ff21ec6b7f1756ce6ccf25b66f80 Reviewed-on: https://code.wireshark.org/review/6635 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-09-04tvbuff composite: add modelines infos (tabs)Alexis La Goutte1-0/+13
Change-Id: I9ea2160b550243b45f6798ad3339f6a45b34a4ef Reviewed-on: https://code.wireshark.org/review/3991 Reviewed-by: Evan Huus <eapache@gmail.com>
2014-09-04tvbuff composite: fix Dereference of null pointer found by Clang AnalyzerAlexis La Goutte1-0/+3
Change-Id: Ia43cb2e1cab99e4b769c8dfa0805d8e38e225a1c Reviewed-on: https://code.wireshark.org/review/3990 Reviewed-by: Evan Huus <eapache@gmail.com>
2014-03-04Remove all $Id$ from top of fileAlexis La Goutte1-2/+0
(Using sed : sed -i '/^ \* \$Id\$/,+1 d') Fix manually some typo (in export_object_dicom.c and crc16-plain.c) Change-Id: I4c1ae68d1c4afeace8cb195b53c715cf9e1227a8 Reviewed-on: https://code.wireshark.org/review/497 Reviewed-by: Anders Broman <a.broman58@gmail.com>
2013-09-22emem -> wmem conversion:Pascal Quantin1-1/+1
- ep_tvb_get_bits() -> wmem_packet_tvb_get_bits() - tvb_g_memdup()/ep_tvb_memdup() -> tvb_memdup() - tvb_fake_unicode()/tvb_get_ephemeral_faked_unicode() -> tvb_get_faked_unicode() - tvb_get_g_string()/tvb_get_ephemeral_string()/tvb_get_seasonal_string() -> tvb_get_string() - tvb_get_g_unicode_string()/tvb_get_ephemeral_unicode_string() -> tvb_get_unicode_string() - tvb_get_ephemeral_string_enc() -> tvb_get_string_enc() - update docs accordingly svn path=/trunk/; revision=52172
2013-09-21Add _g_ to the names of functions that allocate glib memory. This is a bit moreEvan Huus1-1/+1
explicit, and frees up the "generic" names (like tvb_memdup) for new signatures that take the appropriate wmem pool. Majority of the conversion done with sed. svn path=/trunk/; revision=52164
2013-09-13Explicitly include emem.h where it is neededJörg Mayer1-0/+2
svn path=/trunk/; revision=51997
2013-08-20Composite tvb (tvb_memcpy/tvb_get_ptr): don't assert with offset == ↵Jakub Zawadzki1-2/+12
tvb->length, and 0 length svn path=/trunk/; revision=51444
2013-08-04Cleanup tvbJakub Zawadzki1-7/+2
- make tvb_ops->tvb_size a gsize field, not function call - remove not needed forward declaration / forward line svn path=/trunk/; revision=51141
2013-07-31Move tvbuff composite structure to their own file.Jakub Zawadzki1-0/+17
svn path=/trunk/; revision=51072
2013-07-31Move composite tvbuff to seperate file (with some subtle changes).Jakub Zawadzki1-0/+275
svn path=/trunk/; revision=51071