Commit Graph

87549 Commits

Author SHA1 Message Date
John Thacker bde79e1992 XMPP: Cleanup xmpp element even if there's an exception
Fix some leaks seen in fuzzed data by using an exception
cleanup routine
2023-05-23 11:33:15 +00:00
John Thacker 06c9e2f23a SNMP: Fix multiple PDU over TCP handling
SNMP over TCP isn't common, but there is an implementation in
the dissector. It doesn't use tcp_dissect_pdus because of the ASN.1
parsing.

Fix a typo when there are multiple PDUs in a single frame - the
new offset needs to be passed so that later PDUs are dissected.
Also the return value when there isn't enough data to determine
the necessary length needs to be 0, not -1, due to how the SNMP
dissector handles it before handing back to TCP.

Fix some issues seen in fuzzed files.
2023-05-22 20:50:22 -04:00
John Thacker 15e583afbd TLS: Handle cleartext handshakes after CCS
Everything in the same TLS session is supposed to be encrypted after
the Change Cipher Spec, including a subsequent new handshake for
TLS renegotiation. Some clients have a buggy implementation of
renegotiation and send the new handshake in the clear.

Change around the encrypted handshake heuristics some. If we're
after the CCS, but it looks like a new ClientHello or ServerHello,
assume this is a new cleartext TLS handshake and reset the CCS state.

Fix #18867
2023-05-22 20:31:27 +00:00
Martin Mayer daecf5df0e SAPHDB: Add header length check
Adds check for minimal header length before `tcp_dissect_pdus`.
(related to #19075)
2023-05-22 19:46:18 +00:00
Allan Møller Madsen 545c48200f bthci_evt: Additional dissection of HCI events (from v5.4 spec)
Dissection of Bluetooth HCI events added in v5.4 spec:
LE Periodic Advertising Sync Established [v2] event
LE Periodic Advertising Report [v2] event
LE Periodic Advertising Sync Transfer Received [v2] event
LE Enhanced Connection Complete [v2] event
2023-05-22 19:21:54 +00:00
Gerald Combs de593771de batadv: Initialize a variable before using it
Make sure iv_ogm_packeth->tvlv_len is initialized before we use it.

Blind attempt at fixing #19047
2023-05-22 11:36:29 -07:00
Nardi Ivan 10b93c1acc Add support for UDP Tracker Protocol for BitTorrent 2023-05-22 16:53:17 +02:00
John Thacker ac56bdc70a per: Fix leak in dissect_per_open_type_internal
tvb_new_octet_aligned() can throw an exception, and creating
a new composite TVB but not appending any data (and thus not
attaching it to a chain) leaks data because the composite TVB
is never freed. So try to create the aligned fragment TVB first
before creating the composite TVB.
2023-05-22 13:23:53 +00:00
John Thacker cd02e73fcf DOF: Fix leak in packet data
The packet data is a file scoped structure. Use a similarly scoped
wmem_list instead of a GSList structure, which has compatible
API calls but avoids leaking without complicated memory management.
2023-05-22 11:53:32 +00:00
John Thacker 1db595d1bd Decode As: Keep current handle and description consistent
Make the current dissector description and handle private
members of DecodeAsItem, and change them in tandem.
2023-05-22 07:24:14 -04:00
Alexis La Goutte 7b2db3d661 usb-hid: fix typo for 0x33 (Rx), 0x40 (Vx), or 0x43 (Vbrx)
use wrong labels/name: (Rz, Vz, Vbrz)

Issue reported by Daniel Höpfl

Closed: #19095
2023-05-22 10:41:37 +00:00
Martin Mathieson 572f104638 check_tfs.py: allow more chars in RE, and fix issues seen 2023-05-22 10:33:38 +00:00
Nikolas Koesling 883a4bc58d add subdissector s7comm-bsend for s7comm bsend data
call subdissector for s7comm bsend data if there is a heuristic dissector registered for s7comm-bsend
2023-05-22 10:32:38 +00:00
Matthias Ringwald 35f29e0d17 Bluetooth SDP: fix protocol descriptor list parsing
The updated code uses a helper variable to check if all data elements have been processed
2023-05-22 07:51:59 +00:00
João Valverde aa6b8368b7 MSYS2: Add support for building a stand-alone NSIS installer
This changes the existing code for the MSVC installer as little
as possible to allow building the Wireshark .exe Windows installer
using the MinGW-w64 toolchain.

Currently the DLL dependency list is static, this may change in
the future. Ideally we would use CPack and install() logic
to copy the DLLs.

The msys2checkdeps.py script is copied from the Inkscape project[1].
It doesn't have a specific license identifier. The Inkscape project
is licensed under the GPL version 2 or later.

TODO: Download Npcap and USBPcap using CMake instead of requiring
manual action.

[1]https://gitlab.com/inkscape/inkscape

Ping #17771.
2023-05-22 00:54:39 +01:00
Gerald Combs 83cebf9563 NSIS: Remove our copy of x64.nsh
Remove our copy of x64.nsh. NSIS ships with a better one.
2023-05-21 14:46:59 -07:00
Gerald Combs 624cdacd4e Windows: Update our libssh packages and add Lua for Arm64
Update libssh to 0.10.5 and add an Arm64 version. Add an Arm64 version
of our customized Lua.
2023-05-21 13:51:59 -07:00
Martin Mathieson a4df6e1eb1 More tools/check_typed_item_calls.py fussing 2023-05-21 20:23:18 +00:00
Gerald Combs 5eab2f8b63 [Automatic update for 2023-05-21]
Update manuf, services enterprise numbers, translations, and other items.
2023-05-21 16:23:42 +00:00
David Fort 1ed4d8fd25 rdp_drdynvc: fix reuse of dynamic channel ids
In the RDP dynamic channel, even inside a connection, channel ids aren't unique,
so an id can be reused for different channels. That most notably happens when
the server opens a channels and the client answers that it's not available. Then
the next connection attempt on another channel will reuse the channel id.
This patch fixes that by indexing dynamic channels with a multimap.
2023-05-21 14:29:27 +00:00
John Thacker 364eadbd7a MySQL/MariaDB: last stmt id is per frame data
After some recent changes, the last known stmt id is stored so that
it can be used in cases where it is not included with a response
(and the last prepared statement should be used instead.)

However, much like the overall state variable, this needs to be stored
in per-frame data, so that it works with random access to frames,
instead of only being in conversation data and only working in a
sequential pass.
2023-05-21 14:28:21 +00:00
João Valverde 62b427c611 Initialize some variables [-Wmaybe-uninitialized] 2023-05-21 13:57:32 +00:00
João Valverde ab82e54dfa MSYS2: Update README
[skip ci]
2023-05-21 13:56:37 +00:00
John Thacker c4f37d77b2 synphasor: Use val_to_str_const
Don't use a value from packet data to directly index a value_string,
particularly when the value string doesn't cover all possible values.

Fix #19087
2023-05-21 12:31:50 +00:00
John Thacker de347765f5 Decode As: Don't crash on a (none) configuration entry
Our current code doesn't allow truly disabling decoding via
Decode As for something with a default handle through the GUI,
but if the decode_as_entries configuration file has such an
entry (which it could if edited manually), don't crash from
attempting to lookup information about the NULL protocol handle
to set a nonexistent preference.
2023-05-21 07:52:04 -04:00
Eugène Adell 5bd4bb8b27 TCP: Conversation Completeness wrong value for some protocols
Some protocols such as FTP might create TCP conversations in
advance before the concerned packets are even parsed. This was
bringing an issue with the completeness value.

Fix #19092
2023-05-21 11:33:28 +00:00
Eugène Adell 8101d02c5e TCP: don't mark Ports Reused when it is only a Retransmission 2023-05-21 10:38:16 +00:00
John Thacker 7ade1e36cb Qt: Only have a getter for the default dissector
The DecodeAsItem determines the default dissector programmatically
when the table or value is changed. Other classes don't need to update it.

There's a value for the default dissector for a table and value written to
the decode_as_entries configuration file, but that has never affected
anything, because the actual default dissector is used. It is only
useful for information when inspecting or viewing the file.
2023-05-20 23:28:04 -04:00
John Thacker 3a3abaec59 Qt: Decode As: Add values from all the layers as suggestions
When selecting a value for Decode As, values that appear in the
current packet are added as a combobox. Currently it only adds
the values from the last layer that contains a protocol. Add
the values from all the layers where the protocol appears to the
combobox instead.
2023-05-21 02:47:19 +00:00
Gerald Combs 46dd9c31bb Windows: Update our GnuTLS packages
Use custom-built packages with MSYS2 dependencies and add an Arm64
package. This adds duplicate iconv and intl DLLs; hopefully that won't
be an issue.
2023-05-20 19:05:01 -07:00
John Thacker 53f4f1b13d pgsql: Implement GSS-API session encryption
Implement GSS-API session encryption for PostgreSQL, with a
dissector that is called if it has been negotiated. Note
that the Kerberos decryption preference has to be set to attempt
decryption (and it won't work without loading secrets.)

Fix #19082
2023-05-20 19:10:07 -04:00
John Thacker 2155b387a8 gssapi: Remove dependency on dcerpc header
Forward declare incomplete types for the dcerpc dissector structs
used as a pointers by gssapi functions, so that dissectors that
include packet-gssapi.h no longer have to include packet-dcerpc.h
(unless actually using something from that header).
2023-05-20 18:00:13 -04:00
John Thacker 32e1750343 epan: Reference count fd_heads in reassembled_table
Sometimes the same key gets reused in a fragment reassembled_table.
In some cases this means we should be using additional key information,
like layer number, though fragment_add_seq_next can trigger this
fairly easily (and it even appears intentional with
reassemble_octet_string in packet-ber.c).

The same reassembled data is entered with multiple keys in the
reassembled table for multiple frames. In order to ensure that
data is deleted when no key refers to it anymore, but also allow
new entries to replace old keys, use reference counting.  It is
simpler than the current approach of freeing all the data at
the end when the table is destroyed, and avoids leaking data.

This is about 95% of the leaks in #19034
2023-05-20 00:29:17 +00:00
Guy Harris cb190d6839 netscaler: add more checks to make sure the record is within the page.
Whie we're at it, restructure some other checks to test-before-casting -
it's OK to test afterwards, but testing before makes it follow the
pattern used elsewhere.

Fixes #19081.
2023-05-19 16:32:53 -07:00
Timo Warns 2eb71f3e6e GNSS: make sbas_crc24q() static
make sbas_crc24q() static to limit its visibility to packet-sbas_l1.c
2023-05-19 22:13:22 +00:00
John Thacker cc2fe84bd0 TCP: Don't reassemble out of order if the segments list doesn't exist
If the OOO TCP preference is set, but the tcp analysis struct doesn't
have the OOO segments, because the preference wasn't set when it
was created, don't try to reassemble out of order.

This is an indication of dissecting in an inconsistent state, with
changed preferences but old conversation data created with the old
preference settings. Hopefully it's just a temporary dissection
from a GUI refresh.

Related to #19079
2023-05-19 17:18:24 -04:00
Gerald Combs 035f9531f3 Windows: Update our libgcrypt packages
Switch to automatically built packages and add back libgpg-error.
2023-05-19 20:11:21 +00:00
Lukas Stermann fb5e69e0be Diameter: Fix dissection of SM-RP-UI AVP 2023-05-19 19:31:57 +00:00
Gerald Combs 28fdce547c RTPS: Fixup our g_strlcpy dest_sizes
Use the proper dest_size in various g_strlcpy calls.

Fixes #19085
2023-05-19 15:58:19 +00:00
Martin Mathieson 8c834f528a Fix some more item lengths vs calls 2023-05-19 13:17:55 +00:00
John Thacker a4d6a12093 mysql: Use frame data current state
Use the current state for the given frame, not the state of
the connection, which is the most recent state from the sequential
pass through the file, not necessarily the current state for a frame
when doing random access on a later pass.
2023-05-19 12:42:06 +00:00
John Thacker 6f888c18a9 FiveCo Legacy: Fix leak
A tvbuffer from real data is not automatically freed unless made
into a child of another tvb (and in that case it would likely be
freed at the end of a packet.) Store only the real data, which is
allocated at file scope, in the file scoped table. Create a tvb
on demand in packets that need it, making it a child of the main
tvb so it gets freed.

Switch the hash table to an auto reset wmem map, eliminating the
need for an init routine.
2023-05-19 11:56:39 +00:00
Guy Harris 472fdc1645 blf: don't ws_debug the value of *data_offset on an error.
*data_offset has whatever value happens to be there, and it's not
guaranteed to have been set to any useful value, especially when the
first packet is being read.
2023-05-19 02:38:14 -07:00
Guy Harris 9eee508103 blf: plug another leak-on-error.
If inflate() fails, call inflateEnd() on the stream we initialized, to
free up any dynamically-allocated data structures attached to it.
2023-05-19 01:52:25 -07:00
Guy Harris e6a2976af6 blf: plug some leaks on read errors.
If we've allocated a buffer of compressed data or a buffer into which
we're uncompressing that data, and we get an error, free those buffers.

If we've allocated a buffer of compressed data, and we *don't* get an
error reading or uncompressing that data, free it once we're finished
uncompressing it.
2023-05-19 00:54:43 -07:00
Guy Harris f10a66999b blf: fix a case where an error wasn't being reported.
If blf_pull_logcontainer_into_memory() gets a short read when reading co
pressed data, report it as Yet Another Internal Error, so it doesn't get
treated as an EOF by callers.

Before the recent fixes, blf_pull_logcontainer_into_memory() just
returned either "success" or "failure", and the latter was always turned
into an internal error; the recent fixes let
blf_pull_logcontainer_into_memory() return more information about the
error, including returning whatever the error was from
wtap_read_bytes_or_eof(), which could be WTAP_ERR_SHORT_READ, which, as
per the above, got treated a an EOF.

This all needs much reworking, with the help of something approximating
a detailed description of the file format.
2023-05-18 23:57:43 -07:00
Guy Harris 8780332817 blf: don't assume that app text is null-terminated in the file.
When reading the text from an app text message, allocate a buffer one
byte larger than the size of the message, and set that byte to '\0'
after reading the message text, to ensure that the text is
null-terminated and can be safely handed to routines that process C
strings.

Fixes #19084.
2023-05-19 01:31:55 +00:00
John Thacker 1c45a899f8 MS-MMS: Use format_text_string()
The length of a string transcoded from UTF-16 to UTF-8 can be
shorter (or longer) than the original length in bytes in the packet.
Use the new string length, not the original length.

Use format_text_string, which is a convenience function that
calls strlen.

Fix #19086
2023-05-19 00:46:56 +00:00
Gerald Combs c76ec1eeeb GitLab CI: Fix our pre-commit check
Use $CI_COMMIT_SHA instead of HEAD.
2023-05-19 00:07:14 +00:00
Gerald Combs a7106f6e96 UI: Allow Arm64 updates on Windows 2023-05-18 23:57:59 +00:00