Commit Graph

204 Commits

Author SHA1 Message Date
Guy Harris 8195bdd340 Rename a bunch of things with "conversation".
A conversation in Wireshark might have two endpoints or might have no
endpoints; few if any have one endpoint.  Distinguish between
conversations and endpoints.
2022-08-25 20:02:20 -07:00
Dylan Ulis c758e9d9c0 LLDP: Add CIP TLVs 2022-06-11 00:18:11 +00:00
Dylan Ulis 3aae474c49 CIP: Minor updates
1. Improve code documentation
2. Expose common variables,functions to let other dissectors to use them
2022-06-02 17:43:24 +00:00
Dario Lombardo 6c3e4c7304 enip: init address on declaration.
CID: 1499496
2022-04-19 20:45:24 +00:00
Dylan Ulis f4703d4dcf CIP: Forward Close Req: Show connection parameters 2022-03-10 21:13:25 +00:00
Dylan Ulis 1a4ef97e45 CIP Security: Update attribute values 2022-03-09 10:49:52 -05:00
João Valverde 8efad466c4 Tools: Fix fix-encoding-args.pl ASCII string validation
Do not require a useless ENC_NA parameter for string encodings.
FT_STRING and FT_STRINGZ types don't have any ndianness.

Follow-up to 6ec429622c.
2022-02-15 11:38:16 +00:00
João Valverde 0ccd69e530 Replace g_strdup_printf() with ws_strdup_printf()
Use macros from inttypes.h.
2021-12-19 21:21:58 +00:00
João Valverde 22ee2764a7 Replace g_snprintf() with snprintf() (dissectors)
Use macros from inttypes.h with format strings.
2021-12-19 20:25:11 +00:00
Evan Huus cdfab0d6e9 tvbuff: convert helper methods to pinfo->pool
A few of them just needed scratch memory, so allocate and free it
manually after doing any exception-raising checks.

A few others were returning memory, and needed conversion to accept a
wmem scope argument.
2021-09-01 03:54:52 +00:00
Dylan Ulis 3c24694048 CIP: Match Connection ID from different fields 2021-08-04 19:34:11 +00:00
Dylan Ulis 3f9b0e36ea ENIP: Updates from latest spec
1. New EtherNet/IP commands and Common Packet Formats
2. CIP Security: Attributes (These go better in enip vs cip dissector)
3. TCP/IP object: Improve existing attribute parsing
4. Certificate Management Object: Attribute
5. Add units for some existing types
6. Correct hf_ size mismatch
2021-07-30 21:46:22 +00:00
Evan Huus 8ee8808876 First pass pinfo->pool conversion, part 2
Automated find/replace of wmem_packet_scope() with pinfo->pool in all
files where it didn't cause a build failure.
2021-07-21 09:54:57 -04:00
Alexis La Goutte a4319f3254 ieee80211: fix Wmissing-prototypes
no previous prototype for function 'add_ff_action_public_fields' [-Wmissing-prototypes]

Change-Id: I8be64454a21187cf60a04c903acfbb18f2a12095
2020-09-09 06:06:29 +00:00
Martin Mathieson a7c8da4216 Fix build where compilers can't initialise multi-field struct with {0} 2020-08-30 16:36:02 +01:00
Dylan Ulis 0e2cd329e3 CIP: Combine connection structs
Notes:
1. There are no functionality changes with this delivery
2. This change is to reduce manual copying between structs. This will make it easier to add upcoming feature changes, and fix some connection handling issues (future merge requests).
3. Combine enip_conn_val_t and cip_conn_info_t. Previously, there were 2 different structs to track information about an overall CIP Connection.
2020-08-27 19:56:13 -04:00
Dylan Ulis ba34033df4 CIP: Combine handling for cip_connID_info_t connections
Notes:
1. There are no functionality changes with this delivery
2. cip_connID_info_t describes a one-way connection. Each CIP Connection includes 2 of these. Previously, each operation was duplicated for each direction.
3. This change is to reduce copypaste, simplify logic, and make it easier to add upcoming feature changes, and fix some connection handling issues (future merge requests)

Changes:
1. Extract Method: get_conversation_info_one_direction
2. dissect_net_param16/dissect_net_param32: Parse and set data into cip_connID_info_t
2020-08-27 15:31:11 +00:00
Alexis La Goutte fc3a9d3328 enip: fix no previous prototype for function
packet-enip.c:1102:19: warning: no previous prototype for ‘create_connection_id_list’ [-Wmissing-prototypes]

Change-Id: I6e0caa29f5617a5688cddaa4d8001a260228294e
Reviewed-on: https://code.wireshark.org/review/37740
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2020-07-06 14:50:14 +00:00
Guy Harris e1d9a226a2 Fix the type of arrays of pointers to hf_ values for bitfield routines.
The static arrays are supposed to be arrays of const pointers to int,
not arrays of non-const pointers to const int.

Fixing that means some bugs (scribbling on what's *supposed* to be a
const array) will be caught (see packet-ieee80211-radiotap.c for
examples, the first of which inspired this change and the second of
which was discovered while testing compiles with this change), and
removes the need for some annoying casts.

Also make some of those arrays static while we're at it.

Update documentation and dissector-generator tools.

Change-Id: I789da5fc60aadc15797cefecfd9a9fbe9a130ccc
Reviewed-on: https://code.wireshark.org/review/37517
Petri-Dish: Guy Harris <gharris@sonic.net>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2020-06-19 11:32:26 +00:00
Dylan Ulis 2342872ed4 ENIP: TCP/IP Object Updates
1. Status Attribute - Decode more bits
2. IANA Port Admin Attribute

Bug: 16443
Change-Id: Ic74226c373ba2a68d6e8d8c0e804661b778332a2
Reviewed-on: https://code.wireshark.org/review/37196
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2020-05-15 04:00:02 +00:00
Dylan Ulis c0a4b8b30f ENIP: Code Cleanup
No real functional changes:
1. Remove some types that don't appear in the spec
2. Change some variable names and text descriptions to match spec
3. Pull out some logic to separate functions
4. Correct variable types to match the interface types

Change-Id: I82ae74fd709c2ec893d20c50eaa36f6c86e20634
Reviewed-on: https://code.wireshark.org/review/37162
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2020-05-08 05:37:42 +00:00
Stig Bjørlykke a673a50ad8 epan: Rename dissector_filters.c to conversation_filter.c
For the same reason as in g89c9d909.

Change-Id: I5e344ebdf8ba05d169484aa32b409d84edc6124f
Reviewed-on: https://code.wireshark.org/review/34943
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-11-04 10:17:16 +00:00
Guy Harris 20800366dd HTTPS (almost) everywhere.
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>
2019-07-26 18:44:40 +00:00
Martin Kaiser c6ebd5bf36 register_decode_as_next_proto: remove the "title" parameter
Remove the "title" parameter from the register_decode_as_next_proto()
function. This parameter is no longer required since decode_as_t does
not have a title any more.

Change-Id: I300c755bd465453aa91703b53ce9adc954e38c00
Reviewed-on: https://code.wireshark.org/review/33579
Reviewed-by: Martin Kaiser <wireshark@kaiser.cx>
Petri-Dish: Martin Kaiser <wireshark@kaiser.cx>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-06-13 05:38:22 +00:00
Dylan Ulis 66b3a33bcb ENIP: Add more Ethernet Link attributes
Add attributes 11-13

Bug: 15610
Change-Id: Ie780ee1f12b6d4ad8f1d42c1d9e534e208f8a58c
Reviewed-on: https://code.wireshark.org/review/32882
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-04-18 13:31:09 +00:00
Dylan Ulis 7a89e6ad56 CIP Security: Fix some off by 1
Some offsets were not incremented after being read, but the next field
assumed it was incremented.

Change-Id: Ifb523bc37f454cfc76d077d34c3efa2663fb6b9e
Reviewed-on: https://code.wireshark.org/review/32873
Reviewed-by: Anders Broman <a.broman58@gmail.com>
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2019-04-17 04:35:08 +00:00
Gerald Combs 8d3ac3af86 epan: Convert our PROTO_ITEM_ macros to inline functions.
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-04-04 04:03:38 +00:00
Dylan Ulis f2dc64e9b8 CIP: Fix false positive expert info
Some buffer size checking was off by 1.

Change-Id: Ib99da61f476b6f20abe40311fd2112a8693a7878
Reviewed-on: https://code.wireshark.org/review/31946
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-02-11 05:07:13 +00:00
Dylan Ulis ae394464df CIP: Improve API/RPI precision
1. Show 3 digits of precision after the decimal place for API/RPI when
displaying in ms.
2. Remove displaying the value as hex microseconds.

Change-Id: I483739c13ff0e02bd773b5207b41a5eec6c23289
Reviewed-on: https://code.wireshark.org/review/31583
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-01-18 06:08:11 +00:00
Dylan Ulis 56f988b125 CIP: Correct SSN to SNN
SNN = Safety Network Number

No functional/parsing changes.

Changes:
1. Fix some display fields and filter names that previously used the
incorrect ssn naming.
2. Changed all variable names in a similar way.

Change-Id: I7bdc52a5aef31a9c6007545d5a79c99bab6cd184
Reviewed-on: https://code.wireshark.org/review/31549
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-01-15 05:39:01 +00:00
Guy Harris 7eb3e47fa4 Try to squeeze some bytes out of the frame_data structure.
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-12-27 04:34:29 +00:00
Dylan Ulis 3757db3148 ENIP: Add more error checking
1. Added a check that the Common Packet Format Item Length < remaining
  data for that layer.
2. Added a check that there should always be at least 4 bytes available
  for each Common Packet Format item (Type ID + Length)

Change-Id: Ie6f2b7904d52d8699c06cfef6844cf0032293d97
Reviewed-on: https://code.wireshark.org/review/31002
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-12-11 04:41:13 +00:00
Dylan Ulis 39ac1a6694 CIP: Add Connection Index
Add cip.connection. This works just like tcp.stream, but for CIP
connections. This is added to CIP connected messages and the Forward
Open/Close messages.

Change-Id: Ib358c00dc0a4fd61065cb22b0e9b574ac43a44a4
Reviewed-on: https://code.wireshark.org/review/30984
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-12-10 14:42:31 +00:00
Dylan Ulis 5762fc617a CIP: Improve connected data information
1. For each connected data message, display generated connection
   information including:
    a. Connection Path from the initial connection
    b. API values
    c. Forward Open packet number. (This already existed, but moving it to a
       consistent place in the tree)
2. Display O->T or T->O in the Info column depending on the direction of data.
3. Remove cip.conn_path_class filter. This was originally added to show
   which type of data is in a given packet. But, it's not really needed
   anymore because we have the generated connection path in each connected
   data packet now.
4. Ensure dummy structs used for Decode As menus are zeroed out.
5. memset -> zero initialization

pcaps from the following bug reports are good examples:

Bug: 14939
Bug: 6617
Bug: 14916
Bug: 14958
Change-Id: I63885a5ca41f95e04f855a1e1dcd9ab3684f7eec
Reviewed-on: https://code.wireshark.org/review/30808
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-12-09 07:19:01 +00:00
Gerald Combs 50dbe4df7f Rename packet-ssl* to packet-tls*
Rename packet-ssl{,-utils}.[ch] to packet-tls{,-utils}.[ch].

Change-Id: I4732162ec131ddf0734b3dd191ccc9e48a76ce06
Reviewed-on: https://code.wireshark.org/review/29659
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-09-25 13:24:17 +00:00
Dylan Ulis 140f95a0ca CIP: Various I/O updates
1. CIP Generic I/O: Add a "Decode As" option for CIP Class 1
2. Combine the 2 CIP conversation filters into one. There would never have
been more than 1 selected. This should be easier for users and less
clutter in the conversation menu.
3. CIP Safety: Name the data field as cipsafety.data instead of
enip.connection_transport_data, to make it like other CIP I/O data.
4. Minor: Rename some more variables/functions from enip to cip, to
reflect which actual protocol these are.

Change-Id: Id895f412e3584a5efcb7e69175a1b2bb3d5e9627
Reviewed-on: https://code.wireshark.org/review/28610
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-07-06 08:45:42 +00:00
Dylan Ulis 45aecc07c9 CIP: Improve Class 2/3 connection handling
1. Add new dissector table that allows for registration of CIP Class 2/3 Data
   against CIP Class that was used in the Forward Open. This is similar to the
   Class 0/1 I/O dissector table. The new logic is this:
     a. If there is connection info and a table entry: Call the registered dissector
        handle (cip_connection_message_router.pcap).
     b. If there is connection info and no table entry, use the CIP implicit
        dissector (cip_connection_implicit.pcap)
     c. If there is no connection info: Assume Message Router (Class 0x2)
        format (cip_no_connection_message_router.pcap)
2. Remove old dissector table for "enip.sud.iface". The specification states that
   the Interface Handle "shall be zero" for SendUnitData, so there isn't a need
   to have custom handling for different Interface Handle values. SendRRData
   does not have the same restriction, so that dissector table (enip.srrd.iface)
   will stay.
3. Pull out Class 2/3 data processing into separate function: dissect_cip_class23_data()
4. Remove extra unnecessary tree layer in implicit data dissector.

Bug: 14916
Change-Id: Id53a2031a6064551b3915d8954527a7b3261d222
Reviewed-on: https://code.wireshark.org/review/28496
Petri-Dish: Graham Bloice <graham.bloice@trihedral.com>
Reviewed-by: Roland Knall <rknall@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-06-27 23:42:23 +00:00
Guy Harris f56b504067 Don't pass an un-initialized dummy structure to dissect_cip_io_generic().
If we know the information that belongs there, we should fill it in.
Otherwise, we should just pass a null pointer, meaning "we don't know
what this information is", and we should check for the null pointer and
not check the information in question.

Bug: 14894
Change-Id: I4f5249855330db65242d8b6eb6b5bda3af3a1925
Reviewed-on: https://code.wireshark.org/review/28404
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-06-23 23:10:29 +00:00
Alexis La Goutte db4fb82555 enip: fix no previous prototype for ‘dissect_item_sequenced_address/dissect_item_connected_address’ [-Wmissing-prototypes]
Change-Id: Ie0b46e49122197a51a916cc70324c1d80936cac9
Reviewed-on: https://code.wireshark.org/review/28384
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Dario Lombardo <lomato@gmail.com>
2018-06-22 19:57:24 +00:00
Dylan Ulis bef062e56e CIP: Improve I/O handling
1. Add new dissector table that allows for registration of CIP Class 0/1 I/O
   against CIP Class that was used in the Forward Open. CIP Safety is still
   a special case that gets checked before this table. The default handling is
   generic CIP Class 0/1 I/O.
2. Changed most I/O items labelled "ENIP" to "CIP I/O". ENIP is a separate
   protocol/layer, and all the I/O traffic is actually CIP. It was very
   confusing explaining to people they had to look at the wrong protocol
   layer in Wireshark before.
3. Add the generic Class 0/1 I/O as a separate tree layer. CIP Motion and
   CIP Safety I/O were already doing this.
4. Update CIP conversation filtering naming to be more accurate.
5. Clean up some offset handling

Change-Id: I1c226fe1bd8974ed0e90640c875bef21f15f3095
Reviewed-on: https://code.wireshark.org/review/28290
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-06-18 04:07:02 +00:00
Dylan Ulis 94bf85ad26 ENIP: Pull out CPF items to separate functions
dissect_cpf was huge and too hard to read and update.
This change pulls out item parsing into individual functions to make
it easier to read, help troubleshoot a bug related to ENIP TLS
connection filtering (Still investigating), and prep for future features.

There are no functional changes.

Main changes:
1. Pulled out the following code into separate functions:
    dissect_item_list_identity
    dissect_item_cip_security_information
    dissect_item_list_services_response
    dissect_item_sockaddr_info
    dissect_item_sequenced_address
    dissect_item_connected_address
    dissect_item_unconnected_message_over_udp
    dissect_generic_io
    dissect_cip_class01_io
2. More documentation. It was a little hard to follow before.
3. Corrected offset inside the while loop in dissect_cpf(). Previously,
offset pointed to 2 bytes *before* the item actually being processed.

Change-Id: I47894fd5c50b4c3d07f916f81e1b21f8890c8396
Reviewed-on: https://code.wireshark.org/review/28205
Reviewed-by: Dylan Ulis <daulis0@gmail.com>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-06-13 04:11:03 +00:00
Dylan Ulis c9ba7c95df CIP: Use a struct for connection triad
1. Connection Serial Number, Vendor ID, and Device Serial Number are always
used as a group. Group these as a struct to make them easier to manage.
2. Pull out common code into dissect_connection_triad()

No functional changes.

Change-Id: Ide126f8d0ea6ab8e2de5abf20e12643d5a35924d
Reviewed-on: https://code.wireshark.org/review/27926
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-06-01 05:53:13 +00:00
Dylan Ulis bbf31d3d54 CIP Security: Fix Preshared Key parsing
Minor bug fixes:
1. Preshared Keys: Minimum size can be 1, not 3. This shows malformed packets for valid data.
2. Preshared Keys: Display PSK based on PSK size, not ID size.
3. Correct name of some hf types.

Change-Id: Ib412cd109929a1f4a1e5b67b47cb4c9f0eab6512
Reviewed-on: https://code.wireshark.org/review/27929
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-05-31 19:16:38 +00:00
Alexis La Goutte 1266da2c53 enip: Fix Dead Store (Dead assignement/Dead increment) Warning found by Clang
Change-Id: I107e6cb7a9c63e904ed734731d0135201d43554c
Reviewed-on: https://code.wireshark.org/review/27709
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-05-22 14:03:05 +00:00
Dylan Ulis e7056e6ce6 CIP: Code cleanup
1. Convert more things to proto_tree_add_bitmask
2. Remove unnecessary pathpos param everywhere
3. Replace some tvb_get_xxx with proto_tree_add_item_ret_uint
4. Remove unused variables, params
5. Remove if(tree)

There are no functional changes. In the area where there is a lot of
diff (eg: pathpos), I verified using the pcap from Bug: 12049, and
compared the PDML output before and after, just as a sanity check.

Change-Id: I9564172ccece558cf1877b667f713b584a00d73f
Reviewed-on: https://code.wireshark.org/review/27642
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-05-20 05:52:39 +00:00
Dylan Ulis 17c6fb6709 Rename ENIP conversation menus to CIP
Even though these are (currently) implemented in the enip dissector,
these conversations are actually for different types of CIP connections.
This changes makes it obvious to CIP users/developers what these are.

EtherNet/IP (enip) is mainly the encapsulation layer that allows CIP to
function on Ethernet.

Change-Id: I760f832026e35aec412d51d80e85a997b341e0b4
Reviewed-on: https://code.wireshark.org/review/27086
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-04-24 03:47:01 +00:00
Dylan Ulis 2ecb33c039 ENIP packets are not decoded as ENIP anymore
The length check in dissect_enip_tcp() was previously removed but
it's necessary to filter out one byte messages that are mostly likely
TCP keep alives.

Bug: 14434

Change-Id: I44c10aaf0a2e06870ad82f87aab9d72548b77f9f
Reviewed-on: https://code.wireshark.org/review/25807
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot
Reviewed-by: Michael Mann <mmann78@netscape.net>
2018-03-10 21:12:51 +00:00
Martin Kaiser 177962a5b4 enip: use wmem for copied addresses
When we copy an address from pinfo into connInfo->O2T.ipaddress, a
shallow copy is not sufficient. connInfo->O2T.ipaddress is kept across
packets whereas pinfo is valid only for the current packet.

Use wmem with file scope for the copied address. This fixes a
use-after-free error when we access the address in a subsequent packet.

Bug: 14470
Change-Id: I8b74037020189485485a506af6510cb45828e3c4
Reviewed-on: https://code.wireshark.org/review/26248
Reviewed-by: Martin Kaiser <wireshark@kaiser.cx>
Petri-Dish: Martin Kaiser <wireshark@kaiser.cx>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-03-04 07:48:52 +00:00
Guy Harris d332507ef2 Fix the "pointer to function that generates a label" values.
build_label_func is a pointer type, pointing to a function that can be
used to generate a label for a "Decode As" entry.  There's no need to
have pointers to those pointers; have register_decode_as_next_proto()
take a build_label_func, not a build_label_func *, as its last argument,
assign that value rather than dereferencing it, get rid of unnecessary
casts, and fix the comment in epan/decode_as.h for that argument.

Change-Id: Idc3cf18204c543a2191b122c8129b362562c0ecd
Reviewed-on: https://code.wireshark.org/review/25773
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-02-13 18:06:11 +00:00
Dario Lombardo fe219637a6 dissectors: use SPDX identifiers.
Change-Id: I92c94448e6641716d03158a5f332c8b53709423a
Reviewed-on: https://code.wireshark.org/review/25756
Petri-Dish: Dario Lombardo <lomato@gmail.com>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-02-12 16:49:58 +00:00