Commit Graph

71541 Commits

Author SHA1 Message Date
Gerald Combs 9ec5b2b0fe Qt: Implement the capture info dialog.
Add back the capture info dialog. Draw sparklines for each protocol.
Update the User's Guide.

Bug: 12004
Change-Id: I45be8a0df4752255831a8b139ee84bb34d675ba9
Reviewed-on: https://code.wireshark.org/review/27565
Reviewed-by: Gerald Combs <gerald@wireshark.org>
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-05-16 04:26:36 +00:00
Gerald Combs 62999cc677 Windows: Make sure more native dialogs handle HiDPI.
Add a WiresharkFileDialog class, which is a thin wrapper around a few
QFileDialog functions that sets per-monitor v2 DPI awareness before
showing native dialogs and resets the awareness context afterward.
Use it where we call QFileDialog::getXXX.

Change-Id: Ib711a70aa94b693a2515804a729f666ea7fbd673
Reviewed-on: https://code.wireshark.org/review/27568
Reviewed-by: Gerald Combs <gerald@wireshark.org>
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-05-16 04:22:20 +00:00
Alexis La Goutte d3427b8a65 megaco: fix issue found PVS Studio (V517)
The use of 'if (A) {...} else if (A) {...}' pattern was detected. There is a probability of logical error presence.

Change-Id: Id3e4584d1cafebd6643dd97c21916ef6b1818d9d
Reviewed-on: https://code.wireshark.org/review/27510
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-05-16 04:21:08 +00:00
Guy Harris 4dc27d9b7d CMake 3.11.0 has problems on Lion; use 3.5.2, which works.
We're using 3.5.2 on the buildbot.  3.11.0 appears to be getting tripped
up by the libc++ on Lion, cutting off lines at 1024 characters in
generated Makefiles.

Change-Id: Iff1a2fb13ef873e5d0976544f3c8248239a9772d
Reviewed-on: https://code.wireshark.org/review/27570
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-05-16 04:17:25 +00:00
Alexis La Goutte 995b0bab09 ldap: fix issue found by PVS Studio (V1001)
The 'offset' variable is assigned but is not used until the end of the function

Change-Id: Ib626b81f78b1b59547f451952cbdfb1bf04d2205
Reviewed-on: https://code.wireshark.org/review/27507
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-05-16 04:15:34 +00:00
Alexis La Goutte e18d20c728 wbxml: fix issue found by PVS Studio (V1001)
The 'len' variable is assigned but is not used until the end of the function

Change-Id: I98f0cc298e503412e0bdf8919a4a7be8ef45a2f9
Reviewed-on: https://code.wireshark.org/review/27506
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-05-16 04:15:06 +00:00
Alexis La Goutte 233c27e9dc smpp: fix issue found by PVS Studio (V1001)
The 'offset' variable is assigned but is not used until the end of the function

Change-Id: Idd5bc657bb0c64020fda0833a7eead357b463be7
Reviewed-on: https://code.wireshark.org/review/27505
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-05-16 04:14:42 +00:00
Alexis La Goutte e2ebd8c72a rtps: fix issue found by PVS Studio (V1001)
The 'offset' variable is assigned but is not used until the end of the function

Change-Id: I699c8ea4c6533b9834aefbd12b920b04876773ee
Reviewed-on: https://code.wireshark.org/review/27504
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-05-16 04:14:15 +00:00
Alexis La Goutte c05757ff35 h264: fix issue found by PVS Studio (V1001)
The 'bit_offset' variable is assigned but is not used until the end of the function

Change-Id: Id71b12177b6259decd3db801e9833dd46419bdc4
Reviewed-on: https://code.wireshark.org/review/27503
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-05-16 04:13:45 +00:00
Peter Wu 67c6420473 ber: clamp BER lengths to avoid integer overflow
Many callers treat the length as signed integer, so ensure that the
length fits in such a number. Failure to do so can have unintended
consequences (such as calling "tvb_memdup(tvb, 0, -1)" and assuming that
the length is actually 2^32-1).

Although an exception could be thrown as well, let's give the caller a
chance to handle this themselves.

Change-Id: If92545f7d3603250f75741040435000ba879b7e3
Ping-Bug: 14682
Reviewed-on: https://code.wireshark.org/review/27563
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-05-15 17:17:33 +00:00
Peter Wu df5a8b29bb ber: fix buffer overrun (read) in dissect_ber_constrained_bitstring
The length is an unsigned integer, but some users (such as tvb_memdup)
expect signed integers and treat negative values specially.

Bug: 14682
Change-Id: Ic3330d23d964b5cc44718b61c8985880f901674d
Link: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=8011
Reviewed-on: https://code.wireshark.org/review/27562
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-05-15 17:17:07 +00:00
Peter Wu 9ee790e99c tvbuff_zlib: reject negative lengths to avoid buffer overrun
Negative lengths and empty buffers are not uncompressable, reject them.
A buffer overrun (read) could occur otherwise due to unsigned "avail_in"
becoming insanely large.

Bug: 14675
Change-Id: I20b686cc6ad6ef8a8d1975ed3d2f52c8eb1f1c76
Link: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=7166
Reviewed-on: https://code.wireshark.org/review/27561
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-05-15 17:16:12 +00:00
Peter Wu e67283ddca ISMP: fix tuple decoding
EDP_TUPLE_HOLD dissection was broken due to a length parameter mixup in
v1.99.1rc0-224-g6720c80bab. The TLV length calculation was changed in
commit ed5453d892, but the only pcap I could find for which it made a
difference includes the TL lengths in the length field.

Since commit 067a076179, the IPXNET type was wrongly decoded, fixed now.
Check IPX address length to avoid a buffer overrun (read) in
get_ether_name by at most 5 bytes.

Bug: 4943
Bug: 14672
Link: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=6451
Change-Id: Ia99ab15578ecae6d5a3ec22989507d64f9926933
Reviewed-on: https://code.wireshark.org/review/27554
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-05-15 17:14:20 +00:00
Dario Lombardo 2af0e81071 dissectors: fix uint to int wrong sign promotion.
The result of guint16 * guint16 can lead to a wrong sign promotion,
when the result is assigned a uint64. Fixed by forcing the operands
to be guint32.

CIDs:
1247713
1111813
1111812
1111811
1111810
1111809
1111808
1111807

Change-Id: Ibca08ee3766f6c79b933c3db7ccd1f8f906cb3fe
Reviewed-on: https://code.wireshark.org/review/27441
Petri-Dish: Dario Lombardo <lomato@gmail.com>
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-05-15 17:12:45 +00:00
AndersBroman d7ea76d1e5 x509: Add decoding of Userid
"0.9.2342.19200300.100.1.1" "id-userid"

Bug 14655
Change-Id: Ia5d9a5655f411fe47ec60ad897254adec2d28b47
Reviewed-on: https://code.wireshark.org/review/27564
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-05-15 17:10:33 +00:00
Ivan Nardi 2db3db56bf umts_rlc, umts_mac: fix memory leaks (found via ASAN)
Such leaks are triggered by malformed packets

Change-Id: Ie392834b235cf9c5a249ede7fffb5a0dbdb360e5
Reviewed-on: https://code.wireshark.org/review/27556
Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
2018-05-15 14:22:34 +00:00
Роман Донченко 3ba56ce586 wiretap: Add a reader for files in the PEM-like format specified by RFC 7468
Change-Id: I8109025120d01c915f3a9d5550aa9272ec83893a
Reviewed-on: https://code.wireshark.org/review/27334
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
2018-05-15 12:47:06 +00:00
Peter Wu 48fac2a18d gsm_a_dtap: fix off-by-one buffer overflow (write)
The output buffer needs one more byte for the string terminator.

Bug: 14688
Change-Id: I7d606aa8fb769fd65ba894f0472ada3543a1e3cd
Link: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=6420
Reviewed-on: https://code.wireshark.org/review/27539
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-05-15 10:30:36 +00:00
Stig Bjørlykke 171d92cc14 lwm2mtlv: Add Resource name tables
Add one fixed table for OMA (Normative) defined resource names and
one table for user defined resource names. All resources are identified
by a object ID and a resource ID.

Show number of elements in arrays instead of number of bytes.

Next iteration will add proper hf entries for OMA elements.

Change-Id: I4d6c053a7c448cc65692ba1d1e92a2033ff3b397
Reviewed-on: https://code.wireshark.org/review/27551
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-05-15 10:30:18 +00:00
Peter Wu 4c1690ac47 CMake: require at least CMake 3.5
CMake 3.11 with the Ninja generator started complaining about CMP0058
related to ui/qt/CMakeFiles/qtui_autogen.dir/RCCstock_iconsInfo.cmake
amd other files (AUTORCC). While the policy could be set explicitly,
let's try to modernize the CMake configuration:

- Drop CMP0042, if this gives issues with macOS, then it must be solved
  in a different way using non-deprecated methods.
- Drop CMP0054 and ensure that all if("${foo}") and if(${foo}) are
  converted to if(foo).
- Remove string comparison against "-NOTFOUND", it already evaluates to
  false in an if condition.
- Use CXX_STANDARD/CXX_STANDARD_REQUIRED for Qt 5.7 and newer.
- Assume that copy_if_different can accept multiple sources (CMake 3.5).
- Consistency: Out of the 60 CMake 3.11 FindXxx.cmake files that use
  find_library, 34 contain "XXX_LIBRAR" while 16 contain "Xxx_LIBRAR".
  Let's assume uppercase variables (now custom MaxMindDB include dirs
  are correctly used).

CMake 3.5 was chosen as the next version because of its wide support.
Ubuntu 14.04 ships with cmake3 3.5.1, Debian jessie-backports has 3.6.2,
EPEL for CentOS/RHEL6 includes cmake3 3.6.1 and SLES12 SP2 has 3.5.

Change-Id: I2fa7b94bf8cc78411f414987d17bab3a33dfb360
Reviewed-on: https://code.wireshark.org/review/27444
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-05-15 10:28:09 +00:00
Joakim Karlsson e21da73826 CMake: fix Git binary parameter
if (${GIT_EXECUTABLE}) never worked, hence the variable GIT_BIN_PARAM never had
any value, and by so never added the Optional git-bin parameter
to make-version.pl

Make-version.pl now handle optional git-bin argument with value.

Change-Id: I089539a3d33455b8de09928b54e0ea39d1aecbb8
Reviewed-on: https://code.wireshark.org/review/27485
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2018-05-15 09:06:43 +00:00
Pascal Quantin 4fd404d8da Update Eugene Adell's email in .mailmap
Followup of g548f7547fe

Change-Id: I700d9bde2dc73ce2953e804350bfe054817b1818
Reviewed-on: https://code.wireshark.org/review/27552
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
2018-05-15 07:45:45 +00:00
Guy Harris 30ae3847e0 Mention how to get Ninja, and speak more of UNIX and UNIX-like platforms.
And put hyphens in "out-of-tree" and "in-tree".

Change-Id: I55c54a1334f490f948310139741fecf27203a359
Reviewed-on: https://code.wireshark.org/review/27550
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-05-15 06:54:08 +00:00
Guy Harris 81bfa3f7b8 Don't speak of "UNIX".
macOS is a UNIX(R) and FreeBSD isn't a UNIX(R), but we mentioned macOS
along with UNIX but didn't mention FreeBSD along with UNIX.

Instead, just speak of "UN*Xes" and give Linux, macOS, and *BSD as
examples.  Feel free to add Solaris, AIX, or HP-UX if you want, assuming
you can build Wireshark on them.

Change-Id: I85be3861fa0bc603b93d077a2d9d587d43cb6e7e
Reviewed-on: https://code.wireshark.org/review/27549
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-05-15 06:38:56 +00:00
Guy Harris 9c20675d0e Give Ninja build instructions if we've installed Ninja.
Change-Id: I629f0e48e1b66ae9bb65f025669fd94b2480e765
Reviewed-on: https://code.wireshark.org/review/27548
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-05-15 06:33:21 +00:00
Guy Harris ec8b402a76 Download and install Ninja.
The Developer's Guide recommends Ninja for all UN*Xes, so download it
rather than having to say "but on macOS use make".

Change-Id: I147b96144c25d01151c68e13d249172023b1fccc
Reviewed-on: https://code.wireshark.org/review/27544
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-05-15 03:43:53 +00:00
Guy Harris e7db145b7f Get rid of debugging printout.
Change-Id: I6641aca753b40a8a06ce8d3baf47d37cdf0c420a
Reviewed-on: https://code.wireshark.org/review/27543
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-05-15 03:30:04 +00:00
Guy Harris 748c569f88 Clean up Qt installation.
We don't support 32-bit builds on macOS, so get rid of the now-unused
TARGET_PLATFORM variable and the comment about how to build 32-bit
libraries.

Follow the complex rules that Qt's download directories unfortunately
require to get the .dmg for a given release.  Drop support for
installing Qt 4.

CMake doesn't use pkg-config to find the Qt frameworks, so we don't need
to fix up the .pc files (which aren't even shipped with later versions
of Qt).

Change-Id: I5edc69f8b34dac47bb2310689f296ce37347f495
Reviewed-on: https://code.wireshark.org/review/27542
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-05-15 03:26:12 +00:00
Guy Harris 67b9ccd45f Update a comment.
Change-Id: Ia5971b466f2e2da40730933b44bba5672d94c399
Reviewed-on: https://code.wireshark.org/review/27541
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-05-14 22:09:54 +00:00
Guy Harris 33c836af9f Builds require CMake, so always install it.
Don't have an option not to install it.  (If we want to avoid installing
it when it's already been installed by something other than this script,
we should check for its existence before installing, and skip the
installation step for it.)

Get rid of the instructions for autotools builds; always show the
instructions for CMake builds.

We wouldn't get to the uninstall stage if it hadn't been installed by
this script; remove the comment asking about that.

Change-Id: I276ee96bf955ef4ff33dea87bc27c21111301ea0
Reviewed-on: https://code.wireshark.org/review/27540
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-05-14 22:08:03 +00:00
Eugene Adell 548f7547fe changing Author's email for Eugene Adell
Change-Id: Ic8318d63110e4b27c06310467aad4bd71226e93d
Reviewed-on: https://code.wireshark.org/review/27538
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-05-14 20:25:56 +00:00
Gerald Combs f4724d0b37 Qt: MainWindow::dropEvent fixes.
Limit our dropped file count to 100. Make sure we always accept our
proposed action and either accept or ignore the event. Blind attempt at
fixing bug 14609.

Change-Id: Id08b179b6eb63529aa15bce7284460fbd19f7fec
Ping-Bug: 14609
Reviewed-on: https://code.wireshark.org/review/27462
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2018-05-14 15:43:32 +00:00
Peter Wu 4413d43962 rtcp: fix buffer overflow in transport-cc dissection
When the packet status chunks cover more packets than advertised in the
packet status count field, fail rather than writing past the end.
https://tools.ietf.org/html/draft-holmer-rmcat-transport-wide-cc-extensions-01#section-3.1.2

Bug: 14673
Change-Id: If90baef3610d8f884b0772a4b81d6dcb4ebc9227
Fixes: v2.5.0rc0-2533-ga584eab239 ("New RTCP dissector for transport-cc")
Link: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=6464
Reviewed-on: https://code.wireshark.org/review/27527
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Rui Zhang <rzhang@grandstream.cn>
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2018-05-14 14:45:12 +00:00
Peter Wu 10306f9a32 Free g_array_free-related memory leaks
g_array_free(a, FALSE) returns "a->data". Callers that do not handle
this will leak memory. Convert other users to use the return value
instead of direct access to "a->data".

Change-Id: I0a29864e8106c0bf09e9573ef29e4474179c4171
Reviewed-on: https://code.wireshark.org/review/27438
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2018-05-14 13:44:23 +00:00
Peter Wu bb81e1807b Free g_ptr_array_free-related memory leaks
g_ptr_array_free(a, FALSE) returns "a->pdata". Callers that do not
handle this will leak memory (e.g. "tshark -G plugins"). Convert other
users to use the return value instead of direct access to "a->pdata".

Change-Id: I29835477d587f5f54bf0d94cdae9f375e3da3ce3
Reviewed-on: https://code.wireshark.org/review/27437
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2018-05-14 13:42:10 +00:00
Peter Wu d80acae40d tvbuff: make tvb_bytes_exist fail with negative values
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-05-14 13:07:23 +00:00
Peter Wu 17647c4041 fip: avoid tvb_bytes_exist with negative length
This will no longer be a valid way to check for remaining data.

Change-Id: I5533b8efc3344f0f8e28d873e5363256a014ab05
Reviewed-on: https://code.wireshark.org/review/27525
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-05-14 11:28:16 +00:00
Dirk Eibach e0002b0427 extcap: Support for DisplayPort AUX channel monitors
Support for the generic netlink DisplayPort AUX channel monitor kernel driver.

Change-Id: Iab445229ecef082968355f604993292f5f2d8d69
Reviewed-on: https://code.wireshark.org/review/27313
Petri-Dish: Dario Lombardo <lomato@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Dario Lombardo <lomato@gmail.com>
Reviewed-by: Roland Knall <rknall@gmail.com>
2018-05-14 10:44:37 +00:00
Peter Wu 8f4072b481 QUIC: fix initial_max_streams_* decoding and rename it
These are 16-bit fields, not 32-bit. Fixes a malformed packet exception.
While at it, rename fields to match draft-ietf-quic-tls-11-6-g4b762033,
these fields were inconssitently named in draft-11.

Bug: 13881
Change-Id: I797d2b4a24a4f4a9b340db736de0000acd52e639
Reviewed-on: https://code.wireshark.org/review/27491
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-05-14 09:25:55 +00:00
Guy Harris 5fef0e8c37 Fix indentation.
Change-Id: Idb9344f0e08331f9e888a547bff9adf9f01334d5
Reviewed-on: https://code.wireshark.org/review/27524
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-05-14 08:23:41 +00:00
Darius Davis 6e88943d0e BGP: Validate length of Path Attribute records.
Bug 13741 showed a case where the BGP dissector's failure to validate the
length of the Path Attribute record allowed a pathological BGP UPDATE packet to
generate more than one million items in the protocol tree by repeatedly
dissecting certain segments of the packet.

It's easy enough to detect when the Path Attribute length cannot be valid, so
let's do so.  When the condition arises, let's raise an Expert Info error in
the same style and format as used elsewhere in the same routine, and abandon
dissection of the Path Attributes list.

With this check in place, an incorrect length computation is revealed at a
callsite.  This would only have prevented a small (less than 5 bytes) Path
Attribute from being dissected if it was at the very end of the Path Attributes
list, but the bounds checking added in this change makes this problem much more
apparent, so we fix the length computation while we're here.

Testing Done: Built wireshark on Linux amd64.  Using bgp.pcap from the Sample
   Captures page on the wiki, verified that the dissection of the UPDATE
   packets were unaltered by this fix.  Using the capture attached to bug 13741
   (clusterfuzz-testcase-minimized-6689222578667520.pcap), verified that the
   packet no longer triggers the "too many items" exception, instead we see
   an Expert Info for each oversized Path Attribute length, and eventually an
   exception for "length of contained item exceeds length of containing item".
   30,000 iterations of fuzz test with bgp.pcap as input, and many iterations
   of randpkt-test too.  Crafted a packet with a 3-byte ATOMIC_AGGREGATE Path
   Attribute at the end of the Path Attributes list; Before this change, an
   exception is raised during dissection, but after this change it is dissected
   correctly.

Bug: 13741
Change-Id: I80f506b114a61e5b060d93b59bed6b94fb188b3e
Reviewed-on: https://code.wireshark.org/review/27466
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-05-14 08:17:09 +00:00
Dylan Ulis d80dbe533c Display configured checksum Expert summary string
Previously, checksum code would override the expert_field summary
string configured by dissectors, and display the generic "Bad checksum"
string in the Expert Information dialog.

This change uses the configured expert_field summary string instead.
eg: "CRC-S1 incorrect [should be 0xff]" instead of "Bad checksum [should
be 0xff]"

This fixes problem #2 in the linked bug.

Bug: 14425
Change-Id: I168b2be92ec2d8d6f956beeaf6292574bc1d9dab
Reviewed-on: https://code.wireshark.org/review/25758
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-05-14 08:15:39 +00:00
Peter Wu 843735e0ef dns: fix null pointer deref for empty name in SRV record
Per RFC 2782, the name should follow the "_Service._Proto.Name" format.
If a malformed packet does not adhere to this and provides a zero-length
name, then wmem_strsplit returns NULL.

Bug: 14681
Change-Id: I7b9935238a9800a1526c8b694fd2c63d3b488d0b
Link: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=7416
Reviewed-on: https://code.wireshark.org/review/27499
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-05-14 08:14:26 +00:00
Peter Wu 19c4589246 proto: handle split bits covering more than 32 bits
proto_tree_add_split_bits_item_ret_val can handle bits from an arbitrary
sized buffer, as long as it covers no more than 64 bits. If the
octet-aligned mask covers up to 32 bits, then this mask is also shown.
If this mask was larger than 64 bits, then undefined behavior could
occur, so check for that.

For larger masks, instead of "= GmPRS Terminal Type: Unknown (96)",
display "7 bits = GmPRS Terminal Type: Unknown (96)" instead.

Bug: 13613
Change-Id: I111cf6a0705f999e42d83bfe57ac84f414946d0b
Link: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=1158
Reviewed-on: https://code.wireshark.org/review/27517
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-05-14 08:13:47 +00:00
Richard Sharpe b10dbb8614 ieee80211: Conform with IEEE802.11-2016 around VHT MCS Set in VHT Capabilities.
There were a few undissected fields in the VHT MCS Set and some of the fields
were not being placed under the correct sub tree.

Change-Id: I0dc4be1b69d371f59cc74fa06205a3cba2a65c54
Reviewed-on: https://code.wireshark.org/review/27385
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2018-05-14 08:03:38 +00:00
Guy Harris 57e2e0c10d Update some comments.
(Wireshark hasn't been strictly a C program for a while, and we now
allow C99-and-later comments in the C code.)

Change-Id: Ic68e053eed7aae1971a800cf74135bc86d211e97
Reviewed-on: https://code.wireshark.org/review/27520
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-05-14 07:04:03 +00:00
Peter Wu 5e5cc440a2 checkAPIs: handle C++ / C99-style '//' comments
Avoids a warning in epan/dissectors/packet-enip.c due to "time"
appearing in a comment.

Change-Id: I88b6856425c09fc3b8cb2edc345047062a07b662
Reviewed-on: https://code.wireshark.org/review/27516
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-05-14 06:54:19 +00:00
Guy Harris 3a1bf2b87e Use ws_g_warning() for plugin registration errors.
Those should always be reported, as they indicate that a block type
plugin is trying to do something we don't allow.

We should probably have a mechanism by which ws_g_warning() messages are
logged to the standard error for command-line programs, logged to an
error message window for GUI programs, and logged to some form of system
log for daemons.  For now, it's a good way to log non-fatal errors that
should always be shown in *some* fashion, as well as to mark messages
that should be handled in the form described in the previous sentence.

Change-Id: Ieedf87fc2dd3184a4466ae69af01f799165c1b70
Reviewed-on: https://code.wireshark.org/review/27519
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-05-14 06:07:05 +00:00
Dario Lombardo 6dedca3ece wiretap: use pcapng_debug instead of g_warning.
Change-Id: Ibbfe3d1db8b4a7515e7eda194a76d3b0a624542e
Reviewed-on: https://code.wireshark.org/review/27383
Petri-Dish: Dario Lombardo <lomato@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Dario Lombardo <lomato@gmail.com>
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2018-05-14 05:42:53 +00:00
Peter Wu d08a53a7b9 Q.931: fix use-after-free (write) of "q931_pi"
The dissect_q931_number_ie (and indirectly dissect_q931_cause_ie_unsafe)
write to the "q931_pi" structure which seems private to the q931
dissector, but can in fact be called through other dissectors (isup) as
well. Normally this structure is initialized in "dissect_q931_pdu" and
invalidated at the end of the function, but a malformed packet can
prevent the cleanup. In the next packet, a different dissector can thus
trigger a use-after-free via "dissect_q931_number_ie".

Rename "dissect_q931_cause_ie_unsafe" since "unsafe" meant that external
dissectors could not call it directly (see commit a83a87e9ca).

Based on commit 197ceddab1, it seems that the intended purpose of the
structure is to provide information to the VoIP Calls dialog, but it
would only be used when called through dissect_q931_pdu. Dissectors like
isup have their own routines to provide call information, but as a
side-effect of code sharing the problematic code path was reached.

Bug: 14689
Change-Id: I871525db560f24690ade9a0b944c6d0e655ed34b
Link: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=6711
Reviewed-on: https://code.wireshark.org/review/27495
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-05-14 04:46:07 +00:00