Commit Graph

85478 Commits

Author SHA1 Message Date
John Thacker 6156e28a26 dhcp: Convert raw string to UTF-8 before adding to expert info
In PacketCable MTA capabilities, the length of the capability
is store as hex digits in ASCII. If bogus, the incorrect value
is added as an expert info. Ensure that it's formatted as UTF-8
and for display when added to the tree.

Fix #18437
2022-10-18 07:03:38 -04:00
Chuck Craft bc9a5ff70e build: fix typos in alpine-setup.sh 2022-10-17 16:55:28 -05:00
Vadim Yanitskiy b93e8234f6 GSM A-bis/RSL: dissect and show RFN using parse_reduced_frame_number()
3GPP came up with a special encoding of TDMA frame number, which reduces
the amount of bits needed to carry it from 32 to 16.  This encoding is
not only employed on the radio interface (GSM RR), but also on the
A-bis/RSL interface which is used between BTS and BSC nodes.

From the user perspective, parsed RFN value is a lot more meaningful
than the T1/T2/T3 variables used on the wire.  The GSM RR dissector
does show parsed RFN value together with these variables, while the RSL
dissector does not.  Let's show it in the RSL dissector too.
2022-10-17 19:45:15 +00:00
Vadim Yanitskiy 269d3a9968 GSM A RR: expose parse_reduced_frame_number()
This function will be used by the RSL dissector to show parsed RFN
value in the upcoming patch.
2022-10-17 19:45:15 +00:00
Vadim Yanitskiy 9006f25701 GSM A RR: make [parse_]reduced_frame_number() easier to use 2022-10-17 19:45:15 +00:00
Alexis La Goutte 47bd05e494 giop: Fix Dead Store found by Clang Analyzer 2022-10-17 16:44:45 +00:00
John Thacker 0bf410550b smb2: Copy entire Unicode string length
In SMB2, the length of the buffer than contained a UTF-16
unicode string is not necessarily the length of the converted
UTF-8 string, and in some cases can even be shorter than the
length of the UTF-8 string, if the string has many 2 octet
UTF-16 characters that are 3 or 4 octets in UTF-8.

Use wmem_strdup and wmem_strdup_printf instead of wmem_alloc
and sprintf, which is a safer pattern anyway as it reduces
the chance of these errors.

Fix #18482
2022-10-17 07:45:20 -04:00
Guy Harris be60ad9b17 Add include/ws_codepoints.h to the list of public headers. 2022-10-17 00:23:32 -07:00
John Thacker d248702b86 nbt: Eliminate clang analyzer warning
By using strlcat later, we don't need to update pname_ret again,
since we only need the total size of the buffer. Elminates a
clang analyzer warning about writing a value that is never used
related to commit 9891a79137
2022-10-17 00:37:16 +00:00
Guy Harris 1c9c1b5100 Add a #define for REPLACEMENT CHARACTER and use it.
Add UNICODE_REPLACEMENT_CHARACTER as a #define for the Unicode
REPLACEMENT CHARACTER code point (0x00FFFD), and use that instead of
0xfffd/0xFFFD/0x00FFFD in cases where that value refers to REPLACEMENT
CHARACTER.
2022-10-16 23:36:12 +00:00
John Thacker 5fd09b521d ftp: deal with UTF-8
Ensure that FTP doesn't add invalid strings to the tree or columns.
Also allow UTF-8 pathnames to work.

According to RFC 2640, FTP supports UTF-8 for pathnames (and it
MUST be supported even if the other side does not advertise support
for UTF-8, unless a different character set has been explicitly
configured, which is out of scope of the RFCs, and we don't have
such a preference.) So in general interpret strings as UTF-8, not
ASCII.

Reduce the use of tvb_get_ptr by using functions directly on the
original tvb and offset. This also happens to be more compliant
with RFC 2640 when getting the token lengths. (RFC 2640 states
that implementations MUST assume that there is only one space between
a command and the pathname, and treat additional spaces as part of
the pathname instead of skipping them. tvb_get_token_len() does not
skip trailing spaces, but get_token_len() does.)

The only place that still uses tvb_get_ptr is when processing a PWD
command, because it has to deal with the double quote escaping as
a custom encoding.

Add a tvb_ascii_isdigit function.

Fix #18439.
2022-10-16 22:43:39 +00:00
Gerald Combs 94b4202a99 GIOP: Handle recursion and large loops.
dissect_data_for_typecode_with_params is recursive. Add a depth check.
It also has large loops. Make sure our offsets advance.
Fixes #18392.
2022-10-16 22:09:32 +00:00
Bin Peng 2eeb086f70 H265: Support RPS prediction in h265 SPS
According to Rec. ITU-T H.265 7.3.7 and 7.4.8,
when there are multiple RPS in SPS,
RPS can be predicted from previous ones.

But NumDletaPocs used to be a local variable for each RPS,
prediction will always fail.
In this change, NumDletaPocs is  moved from dissect_h265_st_ref_pic_set
to dissect_h265_seq_parameter_set_rbsp, to allow access to previous RPS
data.

This change also move each RPS into a subtree.

Fix #18481
2022-10-16 21:24:06 +00:00
Gerald Combs 44a17f395f [Automatic update for 2022-10-16]
Update manuf, services enterprise numbers, translations, and other items.
2022-10-16 21:08:54 +00:00
Martin Gallo fc052615a6 SAPNI: Added SAP NI as main dissector 2022-10-16 19:59:59 +00:00
Guy Harris f86a0d5ab4 Use wmem_strbuf_append_unichar_repl() to append a REPLACEMENT CHARACTER.
Replace several instances in which a REPLACEMENT CHARACTER was being
appended to a wmem_strbuf with a call to
wmem_strbuf_append_unichar_repl().

This reduces the number of explicit 0x00fffd or 0xfffd or... in the
code.
2022-10-15 14:16:10 -07:00
João Valverde ab7b71605c TDS: Reject invalid ASCII
Fixes #18448.
2022-10-15 20:17:56 +00:00
John Thacker cb23c5e8d7 PER, asn2wrs: Fix permitted-alphabet constrained character strings
Effective permitted-alphabet constraints are only PER-visible for
the known-multiplier character string types (X.691 27.1). When
PER-visible, the upper bound of any code point used in the
alphabet needs to be calculated, in particular for the ALIGNED
variant, because that determines whether or not canonical order
is used (X.691 27.5.2, 27.5.4).

Note that even with the change to asn2wrs.py none of the generated
dissectors change, because we don't have any example of ASN.1
with non-PER visible permitted alphabet constraints because of
using them on non known-multiplier character string types
(like UTF8String).

There's some various edge cases that we still don't handle, but
nothing that any of the ASN.1 modules in the repository use.
(Permitted-alphabet constraints using characters outside the
ASCII range, possibly with "CharacterStringList", "Quadruple",
or "Tuple" notation, permitted-alphabet constraints that are
extensible and thus not PER-visible, etc.)

Also fix a fencepost error with the length of the octets to highlight.

Fix #18468
2022-10-15 17:20:02 +00:00
Martin Mathieson 21b3529be4 ANSI-A: init user_data field in stat_tap_table_item_type entries. 2022-10-15 17:17:11 +00:00
Michael Tuexen 510c22a6a7 TCP: Update TCP TARR support to version 06 of the ID
The dissector now supports draft-gomez-tcpm-ack-rate-request-06.
The rate is now encoded in one byte instead of two.
2022-10-15 15:59:35 +02:00
Brian Sipos 89a63469f9 LTP: Guard itree use when segments have invalid data ranges
This also guards a coverty issue in ltp_stats_tree_packet()
2022-10-15 12:48:49 +00:00
João Valverde c045c70f00 JSON: Clean up stripping of double quotes in members 2022-10-15 12:10:19 +01:00
João Valverde 2d5bc550c8 JSON: Fix validation of UTF-8
Instead of trying to rewrite the validation of UTF-8 for the nth
time first extract a validated string from the parser with
tvb_get_string_enc() and then do the post-processing on that
(unescape, etc.).
2022-10-15 12:10:19 +01:00
João Valverde 995096df70 JSON: Add preference to enable "unescaping" strings 2022-10-15 12:10:19 +01:00
João Valverde d2a488f5d5 wslog: Do not print control characters 2022-10-15 11:08:53 +01:00
João Valverde d4ba8be9d7 Github CI: Rename MSYS2 job 2022-10-14 20:25:07 +00:00
João Valverde a72edfff49 XML: Sanitize UTF-8 input
Fixes #18471.
2022-10-14 21:06:31 +01:00
João Valverde 75eb708143 RTSP: Use format_text() on a string
Fixes #18474.
2022-10-14 18:23:30 +00:00
Richard Sharpe b02fc55253 ieee80211: Correct the number of bits for phi & psi in beamforming matrices
I noticed while implementing the equivalent for 802.11be that the number
of bits for phi and psi angles was reversed. Also, fixed the spelling of
AvgSNR.
2022-10-14 17:44:33 +00:00
Chuck Craft d0ce6e5f81 Github: Ignore symbol changes on the master branch
See #18404 and !8452
2022-10-14 10:31:15 -05:00
João Valverde 3de62e588f wsutil: Rewrite ws_utf8_char_len() using a lookup table
Rewrite for speed and correctness.

This implementation is more strict with invalid
first bytes (continuation bytes, invalid codepoints and
some overlong sequences).

Returns 0 instead of -1 for invalid bytes.
2022-10-14 12:19:11 +01:00
João Valverde eea68c7721 WBXML: Replace tvb_get_const_stringz()
Ping #18447.
2022-10-14 11:04:48 +01:00
João Valverde 8ca0aa78ed SMB Pipe: Replace tvb_get_const_stringz()
Ping #18447.
2022-10-14 11:03:58 +01:00
João Valverde ceca3fed61 DCT2000: Replace tvb_get_const_stringz()
Ping #18447.
2022-10-14 11:00:46 +01:00
Guy Harris 8cca807485 WSDG: tell users not to go for "Qt 6.4 for desktop development".
That will 1) install 6.4, which isn't the recommended LTS version and 2)
install headers and libraries for MinGW-w64, not for Visual Studio.
That means that if you're trying to build with Visual Studio, things
won't work.
2022-10-13 22:40:01 -07:00
John Thacker 790f9eeaa9 PER: Ensure that restricted strings are UTF-8
Use UTF-8 replacement characters for characters outside the
restricted string domain. This is particularly important to
guarantee valid UTF-8 for values outside the ASCII range.

Fix #18423
2022-10-13 21:27:02 -04:00
John Thacker 325506919b epan: Use ws_utf8_truncate for formatted expert infos
Use the convenience function created in 01e2b16ec6
2022-10-13 18:22:44 -04:00
Gerald Combs f10538a102 falcodump: Fix our credential and config file parsing. 2022-10-13 16:32:43 +00:00
Tim Potter b484c41811 wimaxasncp: Fix dissection of message type in packet header
It looks like there was a cut&paste error a long time ago resulting
in the wimaxasncp.message_type field being incorrectly detected as
unused and commented out. Closes #18424.
2022-10-13 14:51:03 +00:00
Dr. Lars Völker 89a3c8679c BLF: Fixing the interpretation of SRR and RTR
This fixes a bug in the canfdmessage64 encoding in BLF that leads to
CAN-FD frames being interpreted as Remote Frames instead of correctly
ignoring the SRR flag. Makes canfdmessage encoding more robust as well.
2022-10-13 14:48:43 +00:00
Dr. Lars Völker 883bc6ef29 TECMP: improve FCS and Padding detection for Ethernet
This patch fixes some bugs that occur with padded Ethernet frames
or Ethernet frames with FCS present.
2022-10-13 14:47:12 +00:00
John Thacker 9891a79137 nbt: Check NetBIOS scope IDs
RFC 1001 says that scope IDs "meet the restricted character set
of the domain system and has a leading period." Convert them from
ASCII (plus possible garbage fuzzed characters) to UTF-8. Also
check for truncation when appending them to the NetBIOS name.

Fix #18412
2022-10-13 12:04:16 +00:00
Michael Tuexen 41fdfcdbfb SCTP: Improve handling of Host Name parameters 2022-10-13 10:14:00 +00:00
Patricia Lindner ceed050c47 LTP: Enhance with generated items, sequence analysis, and statistics
This change adds computed values for reports, sequence analysis between
segments, conversation and endpoint taps, and a new statistics menu
and dialog.
2022-10-13 09:30:55 +00:00
João Valverde 101ad8f29e Github CI: Add MSYS2 build
Ping #17771.
2022-10-13 08:08:11 +00:00
João Valverde c01545ef7c msys2-setup.sh: Add missing git package 2022-10-13 08:08:11 +00:00
John Thacker 900984b3b7 smb: Fix display_unicode_string
In SMB, display_unicode_string is used to handle null terminated
UTF-16LE strings. Do that with the normal API, instead of just
taking every other byte (which works for ASCII and nothing else.)

Do the same fix for the DirectPlay dissector, which borrowed the
code from SMB

Fix #18467.
2022-10-12 23:52:03 -04:00
John Thacker 01e2b16ec6 wsutil/str_util: Add ws_utf8_truncate
Add a convenience function to truncate a UTF-8 string to no more
than certain length, while ensuring that the string ends with
a complete character instead of a partial sequence (by truncating
up to 3 additional bytes as necessary.)

The common use case is when a valid UTF-8 string is copied into
a buffer via snprintf, strlcpy, or strlcat and truncated, to fix
up the end of the string and keep the string valid.

The buffer holding the string must be large enough, and the string
must be valid up to the point of truncation (aside from the possible
partial sequence at the end). For speed, the function does not check
those conditions.

Ping #18412.
2022-10-12 23:21:18 -04:00
John Thacker 87441e45d8 Qt: minizip and minizip-ng size compatibility issues
MS-DOS Date and MS-DOS Time are packed 16-bit values
(https://learn.microsoft.com/en-us/windows/win32/sysinfo/ms-dos-date-and-time)
and when combined they make a 32-bit value.

In the original minizip that comes with zlib, the combined dosDate
parameter is a uLong, which is 64 bits on LP64 platforms. In minizip-ng,
it is a uint32_t.

At one point, minizip-ng renamed the dosDate struct member of
zip_fileinfo to dos_date, but more recent versions changed it back
to dosDate for compatibility, except the size remains different,
so our compatibility check can't distinguish the size.

clang (and possibly other compilers) complain about shortening a 64 bit
unsigned long to a uint32_t so make the return value from our
qDateToDosDate a uint32_t as it should be to avoid warnings on
distributions with minizip-ng

Also the maximum year value that can be stored in the format is
127, since it occupies bits 9-15 of the MS-DOS Date. (There was
probably some confusion since the maximum year is 2107, but its
offset from 1980, not 1900.)
2022-10-12 22:03:34 -04:00
Chuck Craft 3c0936d83e Github actions: newer verions with node12 -> node16
Ping #18462
2022-10-12 20:32:37 +00:00