aboutsummaryrefslogtreecommitdiffstats
path: root/file.c
AgeCommit message (Collapse)AuthorFilesLines
2021-05-22Plug another leak.Guy Harris1-0/+1
If cf_export_specified_packets() succeeds, and it wrote to a temporary file, it leaks the name of the file to which it was writing. Free that after we've renamed that file on top of the target file (safe save).
2021-05-22Remove a duplicate unlink.Guy Harris1-4/+5
In cf_export_specified_packets(), if the loop processing the packets fails, we're going to go to the failure code, which will unlink the file to which we were writing if we were writing to a temporary file, so we don't need to unlink it before going there. While we're at it, note why we don't report any error from wtap_dump_close() in that case.
2021-05-22Plug a memory leak.Guy Harris1-1/+3
If the user aborted the process of exporting packets, if we're writing to a temporary file, we unlink the file, but we don't free the g_mallocated name of the file, so it's leaked. Free it.
2021-02-21wiretap: have file handlers advertise blocks and options supported.Guy Harris1-1/+1
Instead of a "supports name resolution" Boolean and bitflags for types of comments supported, provide a list of block types that the file type/subtype supports, with each block type having a list of options supported. Indicate whether "supported" means "one instance" or "multiple instances". "Supports" doesn't just mean "can be written", it also means "could be read". Rename WTAP_BLOCK_IF_DESCRIPTION to WTAP_BLOCK_IF_ID_AND_INFO, to indicate that it provides, in addition to information about the interface, an ID (implicitly, in pcapng files, by its ordinal number) that is associated with every packet in the file. Emphasize that in comments - just because your capture file format can list the interfaces on which a capture was done, that doesn't mean it supports this; it doesn't do so if the file doesn't indicate, for every packet, on which of those interfaces it was captured (I'm looking at *you*, Microsoft Network Monitor...). Use APIs to query that information to do what the "does this file type/subtype support name resolution information", "does this file type/subtype support all of these comment types", and "does this file type/subtype support - and require - interface IDs" APIs did. Provide backwards compatibility for Lua. This allows us to eliminate the WTAP_FILE_TYPE_SUBTYPE_ values for IBM's iptrace; do so.
2021-02-20BER: get rid of WTAP_FILE_TYPE_SUBTYPE_BER.Guy Harris1-6/+0
Save a copy of the pathname used to open a file in the wtap structure. This allows the BER file reader to put a pointer to it in the pseudo-header; it also would allow file readers to attempt to read "associated" files that have the same name as the file, but with a different extension. Instead of having cf_open() special-case BER files, and calling a routine in the BER dissector to specify the file name to the dissector, have separate dissectors for "dissect packet payload as BER" and "dissect a file as BER", and have the latter get the pathname of the file from the pseudo-header and determine the ASN.1 syntax from that. (Side-effect - this means that you can now dissect a BER file, and have the syntax be determined by the file extension, in TShark as well; the above cf_open() special-casing was *not* done in TShark, so it didn't work before. Now the application code doesn't need to do any of that, so it works in TShark as well as Wireshark.)
2020-12-22Detect and replace bad allocation patternsMoshe Kaplan1-2/+2
Adds a pre-commit hook for detecting and replacing occurrences of `g_malloc()` and `wmem_alloc()` with `g_new()` and `wmem_new()`, to improve the readability of Wireshark's code, and occurrences of `g_malloc(sizeof(struct myobj) * foo)` with `g_new(struct myobj, foo)` to prevent integer overflows Also fixes all existing occurrences across the codebase.
2020-10-26Impose limits on the number of records we read.Guy Harris1-1/+39
Start the limit at 2^32-1, as we use a guint32 to store the frame number. With Qt prior to Qt 6, lower the limit to 53 million packets; this should fix issue #16908.
2020-10-25Revert "Apparently, WS_WIKI_URL() is unworkable not only in C++ but in C."Guy Harris1-2/+2
This reverts commit 5df29254347daab8ab9f530a0b9dfd0b32a40efc. The problem only showed up in tfshark.c, and was caused by tfshark.c using stuff from ui/urls.h but not *including* ui/urls.h.
2020-10-24Apparently, WS_WIKI_URL() is unworkable not only in C++ but in C.Guy Harris1-2/+2
If you use it, GCC 9.3.0 seems to think there's a missing parenthesis somewhere, just as the version of clang++ in my version of Xcode does, even though other versions of GCC don't. I'm clearly missing something obscure about C here; I give up.
2020-10-14Have WTAP_ERR_INTERNAL include an err_info string giving details.Guy Harris1-16/+20
That way, users won't just see "You got an internal error", the details will be given, so they can report them in a bug.
2020-10-02Clean up URLs.Guy Harris1-2/+3
Add ui/urls.h to define some URLs on various of our websites. Use the GitLab URL for the wiki. Add a macro to generate wiki URLs. Update wiki URLs in comments etc. Use the #defined URL for the docs page in WelcomePage::on_helpLabel_clicked; that removes the last user of topic_online_url(), so get rid of it and swallow it up into topic_action_url().
2020-05-06Qt: Stretch last packet list header sectionTomasz Moń1-5/+5
Programatically show the master split widget before elements are added to prevent pending resize events from resizing packet columns to insane widths (in my case orders of magnitude higher than display resolution) Such resize was occuring when loading capture file if configuration file included hidden columns (e.g. 55 defined columns, 8 visible). The resize was not directly visible to user. Resize event call chain included calls to recent_set_column_width() that changed width stored in configuration. Modified configuration column width value would become effective after user added or removed columns. Hide PacketList when freezing and show it when thawing. Do not call setUpdatesEnabled(false) as it leads to widget/preferences columns missynchronization. Clear packet list before freeing frame data. This prevents accessing freed memory in ProtoTree on file close if packet list was in focus and the next widget to get focus is packet details. Ping-Bug: 16063 Bug: 16491 Change-Id: I2c21d928348681af1793b3263815c81ee73d41b0 Reviewed-on: https://code.wireshark.org/review/37029 Petri-Dish: Tomasz Moń <desowin@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2020-05-01Remove some single-SHB assumptions.Guy Harris1-24/+23
Make wtap_file_get_shb() take a section number argument, and update code that called it. In most cases, we convert the code to iterate over sections; in cases where a big code change would be required, we temporarily pass it 0 and mark the code as "needs to be updated for multiple sections". Eliminate cf_read_section_comment(); in calls outside file.c, other code directly calls the libwiretap routines it calls and, inside file.c, we just transplant the code and then fix it not to assume a single SHB. Change-Id: I85e94d0a4fc878e9d937088759be04cb004e019b Reviewed-on: https://code.wireshark.org/review/37000 Petri-Dish: Guy Harris <gharris@sonic.net> Tested-by: Petri Dish Buildbot Reviewed-by: Guy Harris <gharris@sonic.net>
2020-04-03Eliminate duplicate code.Guy Harris1-6/+2
If we're not going to distinguish between "Loading" and "Reloading" in the progress bar here, we don't need to check, when creating the progress bar, whether we're loading or reloading. Should fix Coverity CID 1461194. Change-Id: Ib58799c3a43a7ff549006034e2a47cce1ea87a98 Reviewed-on: https://code.wireshark.org/review/36689 Reviewed-by: Guy Harris <gharris@sonic.net>
2020-04-02Remove duplicate status messages.Gerald Combs1-9/+7
Adding back progress titles in g3069129fe5 revealed the fact that we had duplicate messages in the Qt UI and in file.c. Remove the ones in file.c in favor of the Qt UI, since the latter are translated. Change-Id: I5ff8f1bd34e963e9e66c01420ad8c5fe9c2f0caa Reviewed-on: https://code.wireshark.org/review/36646 Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2020-02-28Qt: Do not display alerts on repeated failed readsTomasz Moń1-0/+14
If read from capture file fails, set a flag that result in subsequent read attempts to not display alert box on read failure. This solves endless "An error occurred while reading the capture file" error when the underlying trace file becomes unavailable. Now it is possible for the user to close the capture file. Bug: 4811 Change-Id: I411bbb3fb717bc994ab1f5e3805e2c8b4ee09c5e Reviewed-on: https://code.wireshark.org/review/36114 Petri-Dish: Tomasz Moń <desowin@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Peter Wu <peter@lekensteyn.nl> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2020-01-12Allow Multiselection of packets to work during live capturesDylan Ulis1-1/+1
During live capture, the previous logic was to jump to row 1 when there is no 'current_frame'. When multiselect is active, there is no 'current_frame', so it would always jump back to row 1, when >1 packet was selected. Bug: 16293 Change-Id: Id1c9eb36fcae83f67ae342be6f9dfc1405ce7025 Reviewed-on: https://code.wireshark.org/review/35747 Reviewed-by: Michael Mann <mmann78@netscape.net>
2019-12-20Use g_file_open_tmp within create_tempfileMichael Mann1-1/+0
Much better to use a known library than create it ourselves. Also remove get_tempfile_path as it's not used. Bug: 15992 Change-Id: I17b9bd879e8bdb540f79db83c6c138f8ee724764 Reviewed-on: https://code.wireshark.org/review/34420 Reviewed-by: Tomasz Moń <desowin@gmail.com> Petri-Dish: Tomasz Moń <desowin@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Roland Knall <rknall@gmail.com>
2019-08-14Wiretap: Fix temporary filename memory corruptionTomasz Moń1-2/+2
The pointer returned by create_tempfile() must not be freed. As the wtap_dump_open_tempfile() callers are freeing the returned filename, duplicate the string so it can be freed. Bug: 15377 Change-Id: Ib0b23aaee748ef67600ef3f7d40610ebbbec721c Reviewed-on: https://code.wireshark.org/review/34272 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2019-07-17file: remove use of g_get_current_timePeter Wu1-39/+18
Replace g_get_current_time by g_get_monotonic_time (since GLib 2.28, we require 2.32) to simplify code and ignore time jumps. Qt does not need the elapsed time, so remove the parameter from the progress callback. Change-Id: Icaad4b909b9cb4bb07d28fcdf3d383d64aa00127 Reviewed-on: https://code.wireshark.org/review/33975 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Reviewed-by: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-04-17Only do the read loop in the TRY block.Guy Harris1-26/+25
That's slightly less arbitrary. Change-Id: Ie505a5d128f00ae3a1d9280ab076e483a85e2be3 Reviewed-on: https://code.wireshark.org/review/32881 Petri-Dish: Guy Harris <guy@alum.mit.edu> Tested-by: Petri Dish Buildbot Reviewed-by: Guy Harris <guy@alum.mit.edu>
2019-04-15Hava a routine to read the currently-selected frome.Guy Harris1-15/+15
Have cf_read_current_record() take a capture_file as an argument and read, into its wtap_rec and Buffer for the currently-selected frame, information for the currently-selected frame. Rename cf_read_record_r() to cf_read_record(). That gives us 1) a routine that reads the currently-selected frame into the wtap_rec and Buffer for the currently-selected frame and 2) a routine that reads an arbitrary frame into the wtap_rec and Buffer supplied to it. If you *want* the currently-selected record, use the former, otherwise use the latter. Change-Id: If6bd5915dd5bc18334d7b89859822a19234153a4 Reviewed-on: https://code.wireshark.org/review/32858 Petri-Dish: Guy Harris <guy@alum.mit.edu> Tested-by: Petri Dish Buildbot Reviewed-by: Guy Harris <guy@alum.mit.edu>
2019-04-11Use a local buffer for rescanning and finding records.Guy Harris1-55/+83
We use one in all the other loop-over-all-records operations, such as retapping, saving, printing/writing dissections, etc.; these are the only ones remaining. Change-Id: Ib854e3a3dfb5c4b05ae103998046f4bd11c39e7e Reviewed-on: https://code.wireshark.org/review/32819 Petri-Dish: Guy Harris <guy@alum.mit.edu> Tested-by: Petri Dish Buildbot Reviewed-by: Guy Harris <guy@alum.mit.edu>
2019-04-08Consistently use NULL when setting current_frame.Guy Harris1-1/+1
Change-Id: I17cf2b341f096d4a3de835c01ad50309483a9e39 Reviewed-on: https://code.wireshark.org/review/32784 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2019-04-08Use a single wtap_rec and Buffer for an entire capture session.Guy Harris1-18/+7
That way we aren't allocating memory, reading packets from a batch, and freeing the memory for each batch of packets delivered by dumpcap; we do the allocation when the capture starts and the freeing when it finishes. Change-Id: If012ab865f3a99d869535ad10827ad8680c1b10c Reviewed-on: https://code.wireshark.org/review/32766 Petri-Dish: Guy Harris <guy@alum.mit.edu> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-04-06Explicitly make cf->{rec,buf} the information for the selected packet.Guy Harris1-2/+24
Move it next to other capture_file fields for the currently-selected packet, add a comment indicating that's what all those fields are for, separate them from the following fields that *aren't* for the currently-selected field, and explicitly use them in cf_select_packet(). Also add a comment about why we're waiting until the end to free up the old cf->edt in cf_select_packet() and cf_unselect_packet(). Change-Id: I1653af06eeb4ebe1131bc08bcaa2dc639932c7fa Ping-Bug: 15683 Reviewed-on: https://code.wireshark.org/review/32764 Reviewed-by: Peter Wu <peter@lekensteyn.nl> Petri-Dish: Guy Harris <guy@alum.mit.edu> Tested-by: Petri Dish Buildbot Reviewed-by: Guy Harris <guy@alum.mit.edu>
2019-04-061514 is a better initial Buffer size than 1500.Guy Harris1-7/+7
Ethernet packets without the CRC are 1514 bytes long, not 1500 bytes long; using 1514 bytes will avoid a reallocation for a full-sized Ethernet packet. Change-Id: Ie8da3f13bf3df07e23e4478b7dcf84f06dec6a9d Reviewed-on: https://code.wireshark.org/review/32761 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2019-04-06Revert "Get rid of the per-capture_file wtap_rec and Buffer."Peter Wu1-91/+74
This reverts commit 9445403f9558901dc54c88754ff21795ea1803f3. cf_select_packet frees the buffer backing the dissection result (cf->edt) which results in use-after-frees when callers try to access the contents. See for example this call trace: * PacketList::selectionChanged * cf_select_packet(cap_file_, row) * frameSelected(row) -> ByteViewTab::selectedFrameChanged * addTab(source_name, get_data_source_tvb(source)) get_data_source_tvb returns the buffer that backs the dissection and must remain valid even after dissection has completed. If this is not done, then a possibly expensive redissection must be done in order to populate the byte view. The temporary memory savings are not worth it. Bug: 15683 Change-Id: Ia5ec2c7736cdebbac3c5bf46a4e2470c9236262d Reviewed-on: https://code.wireshark.org/review/32758 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot Reviewed-by: Guy Harris <guy@alum.mit.edu>
2019-04-05Get rid of the per-capture_file wtap_rec and Buffer.Guy Harris1-74/+91
Most code that reads from a capture_file already has its own wtap_rec and Buffer; change the remaining ones to do so as well. Change-Id: I9b7c136642bbb375848c37ebe23c9cdeffe830c3 Reviewed-on: https://code.wireshark.org/review/32732 Petri-Dish: Guy Harris <guy@alum.mit.edu> Tested-by: Petri Dish Buildbot Reviewed-by: Guy Harris <guy@alum.mit.edu>
2019-04-05Pass Buffer pointers in some more instances.Guy Harris1-21/+25
Change-Id: I07c7f101dbf3507f30a119ab9506378e0fb53d6f Reviewed-on: https://code.wireshark.org/review/32730 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2019-04-05Pass Buffer pointers rather than packet data pointers in some more cases.Guy Harris1-6/+4
Change-Id: I35299464560aff2785a52217d4052da3ffedcd6a Reviewed-on: https://code.wireshark.org/review/32729 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2019-04-05Have wtap_read() fill in a wtap_rec and Buffer.Guy Harris1-19/+43
That makes it - and the routines that implement it - work more like the seek-read routine. Change-Id: I0cace2d0e4c9ebfc21ac98fd1af1ec70f60a240d Reviewed-on: https://code.wireshark.org/review/32727 Petri-Dish: Guy Harris <guy@alum.mit.edu> Tested-by: Petri Dish Buildbot Reviewed-by: Guy Harris <guy@alum.mit.edu>
2019-04-04Use "buf" for Buffer pointers, "pd" for raw packet data pointers.Guy Harris1-5/+5
Change-Id: I3e7067e84653aa6e71052cdcea98c2305bd663e3 Reviewed-on: https://code.wireshark.org/review/32720 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2019-04-04epan: Convert our PROTO_ITEM_ macros to inline functions.Gerald Combs1-1/+1
Convert our various PROTO_ITEM_ macros to inline functions and document them. Change-Id: I070b15d4f70d2189217a177ee8ba2740be36327c Reviewed-on: https://code.wireshark.org/review/32706 Reviewed-by: Gerald Combs <gerald@wireshark.org> Petri-Dish: Gerald Combs <gerald@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-01-25Fix memory ownership when using cf_get_packet_commentPeter Wu1-1/+2
cf_get_packet_comment already has one code path that returns duplicated memory. Be sure to document the requirement to free this memory and adjust Qt to avoid memory leaks. Be firm and assume that wth.opt_comment is owned by wth, so duplicate it before returning it from cf_get_packet_comment. Change-Id: I91f406296c9db5ea21b90fc2e108c37de4528527 Ping-Bug: 7515 Reviewed-on: https://code.wireshark.org/review/31712 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot Reviewed-by: Vasil Velichkov <vvvelichkov@gmail.com> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-01-18wiretap,file.c: ensure DSBs are reapplied on redissectionPeter Wu1-0/+12
After redissection, the TLS dissector did not remember the DSB secrets anymore. Since the secrets callback is only invoked on the sequential read in wtap, be sure to reapply the existing DSBs to the new session. Bug: 15252 Change-Id: I125f095acb8d577c2439a10e3e65c8b3cfd976b9 Reviewed-on: https://code.wireshark.org/review/31584 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-01-03file: remove redundant cast.Dario Lombardo1-1/+1
Found by clang-tidy. Change-Id: I58c11e09ed89e99457635dd843311ce3cf3c6bae Reviewed-on: https://code.wireshark.org/review/31334 Petri-Dish: Dario Lombardo <lomato@gmail.com> Petri-Dish: Guy Harris <guy@alum.mit.edu> Tested-by: Petri Dish Buildbot Reviewed-by: Guy Harris <guy@alum.mit.edu>
2019-01-03epan: use json_dumper for json outputs.Dario Lombardo1-3/+6
They include -Tjson, -Tjsonraw, -Tek. Change-Id: Ib3d700482ce5c29727c3f778cc3c46a1bf7756c4 Reviewed-on: https://code.wireshark.org/review/31000 Petri-Dish: Dario Lombardo <lomato@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2018-12-27Try to squeeze some bytes out of the frame_data structure.Guy Harris1-33/+33
Make the time stamp precision a 4-bit bitfield, so, when combined with the other bitfields, we have 32 bits. That means we put the flags at the same structure level as the time stamp precision, so they can be combined; that gets rid of an extra "flags." for references to the flags. Put the two pointers next to each other, and after a multiple of 8 bytes worth of other fields, so that there's no padding before or between them. It's still not down to 64 bytes, which is the next lower power of 2, so there's more work to do. Change-Id: I6f3e9d9f6f48137bbee8f100c152d2c42adb8fbe Reviewed-on: https://code.wireshark.org/review/31213 Petri-Dish: Guy Harris <guy@alum.mit.edu> Tested-by: Petri Dish Buildbot Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-11-20Add new Secrets API and allow TLS to use pcapng decryption secretsPeter Wu1-0/+2
Add a new secrets API to the core, one that can outlive the lifetime of a single capture file. Expose decryption secrets from wiretap through a callback and let the secrets API route it to a dissector. Bug: 15252 Change-Id: Ie2f1867bdfd265bad11fc58f1e8d8e7295c0d1e7 Reviewed-on: https://code.wireshark.org/review/30705 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-11-16Use an enum for compression types in various interfaces.Guy Harris1-12/+14
This: 1) means that we don't have to flag the compression argument with a comment to indicate what it means (FALSE doesn't obviously say "not compressed", WTAP_UNCOMPRESSED does); 2) leaves space in the interfaces in question for additional compression types. (No, this is not part 1 of an implementation of additional compression types, it's just an API cleanup. Implementing additional compression types involves significant work in libwiretap, as well as UI changes to replace "compress the file" checkboxes with something to indicate *how* to compress the file, or to always use some other form of compression). Change-Id: I1d23dc720be10158e6b34f97baa247ba8a537abf Reviewed-on: https://code.wireshark.org/review/30660 Petri-Dish: Guy Harris <guy@alum.mit.edu> Tested-by: Petri Dish Buildbot Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-11-16Use the dump parameters structure for non-pcapng-specific stuff.Guy Harris1-19/+23
Use it for all the per-file information, including the per-file link-layer type and the per-file snapshot length. Change-Id: Id75687c7faa6418a2bfcf7f8198206a9f95db629 Reviewed-on: https://code.wireshark.org/review/30616 Petri-Dish: Guy Harris <guy@alum.mit.edu> Tested-by: Petri Dish Buildbot Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2018-11-13Don't have _ng versions of the dumper open routines.Guy Harris1-8/+8
Have the routines always take a parameters pointer; pass either null or a pointer to an initialized-to-nothing structure in cases where we were calling the non-_ng versions. Change-Id: I23b779d87f3fbd29306ebe1df568852be113d3b2 Reviewed-on: https://code.wireshark.org/review/30590 Petri-Dish: Guy Harris <guy@alum.mit.edu> Tested-by: Petri Dish Buildbot Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-11-12wiretap: refactor common parameters for pcapng dump routinesPeter Wu1-22/+16
Four variants of wtap_dump_open_ng exists, each of them take the same three parameters for the SHB, IDB and NRB blocks that has to be written before packets are even written. Similarly, a lot of tools always create these arguments based on an existing capture file session (wth). Address the former duplication by creating a new data structure to hold the arguments. Address the second issue by creating new helper functions to initialize the parameters based on a wth. This refactoring should make it easier to add the new Decryption Secrets Block (DSB). No functional change intended. Change-Id: I42c019dc1d48a476773459212ca213de91a55684 Reviewed-on: https://code.wireshark.org/review/30578 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Petri-Dish: Guy Harris <guy@alum.mit.edu> Tested-by: Petri Dish Buildbot Reviewed-by: Guy Harris <guy@alum.mit.edu> Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2018-09-29Define the wtap_rec next to the Buffer.Guy Harris1-1/+1
They are used together; put them together. Change-Id: I13ec1f37a9a141d3717bfde4db6f1b7e501fb794 Reviewed-on: https://code.wireshark.org/review/29928 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-08-22Fixed a bug related to epan initializationAdam Morrison1-5/+5
In various places, <program>_epan_new was called before setting the provider, so the wth field was null. This fix is necessary for the next commit, adding Secrets Description Block, as it uses this field. Change-Id: Ice8ee01c56b3e04fc71d7b2c659d9635cb366951 Reviewed-on: https://code.wireshark.org/review/28868 Petri-Dish: Anders Broman <a.broman58@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-08-01No need to tell the BER dissector the file name for RFC 7468 files.Guy Harris1-2/+1
It's just a hack for "raw BER data" files, giving them a file name that includes the OID to use for the syntax. For RFC 7468 files, the syntax is determined from the label in the pre-encapsulation boundary. Change-Id: Ia656f20f123d2c6a85041f83714a3a1cfefb70b1 Reviewed-on: https://code.wireshark.org/review/28916 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-07-10If we explicitly started a new page, print a column header line if necessary.Guy Harris1-0/+7
Change-Id: I9be7b41ce5ec5ece502035d0ca7c0fbb3eb3b37d Ping-Bug: 14960 Reviewed-on: https://code.wireshark.org/review/28672 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-07-06Plug extension list leak.Guy Harris1-1/+2
Change-Id: Ie3d2d5fb76ca5de2488e270771b94f7374a8838f Reviewed-on: https://code.wireshark.org/review/28640 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-07-06Fix the calculation of a file's "basename".Guy Harris1-0/+46
Strip off only extensions that correspond to file types we know about; QFileInfo::baseName() strips off *all* extensions, where "extension" is "anything preceded by a .", so it turns foo.bar.pcap.gz into foo, not foo.bar. We don't want that; instead, we strip off only those extensions that correspond to file types we know how to read, so we'd strip off .pcap.gz in foo.bar.pcap.gz, and strip off .pcap in foo.bar.pcap, leaving foo.bar in both cases. Change-Id: I5385921ad2f0fef815d52e9902fef15735fd9dae Reviewed-on: https://code.wireshark.org/review/28636 Reviewed-by: Guy Harris <guy@alum.mit.edu>