aboutsummaryrefslogtreecommitdiffstats
path: root/wiretap
AgeCommit message (Collapse)AuthorFilesLines
2016-06-30Remove Makefile.common filesJoão Valverde3-196/+173
Now that nmake build system has been removed they are not needed anymore. Change-Id: I88075f955bb4349185859c1af4be22e53de5850f Reviewed-on: https://code.wireshark.org/review/16050 Petri-Dish: João Valverde <j@v6e.pt> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: João Valverde <j@v6e.pt>
2016-06-22Windows: rename wiretap-${PROJECT_VERSION}.dll to libwiretap.dllPascal Quantin1-3/+1
This aligns the name with what is done for other Wireshark shared libraries. Moreover it allows to compile a wiretap plugin once per major release, without the need to recompile it each time ${PROJECT_VERSION} changes (each nightly build / official release). Change-Id: I53c82277223a4f323079cf695168ac85c2fba523 Reviewed-on: https://code.wireshark.org/review/16058 Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com> Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-06-21pcap: ERF per-Host ID/Source ID interface supportAnthony Coddington1-7/+31
Add encap_priv pointer to libpcap_t. Initialize erf_priv when ENCAP_ERF. Use erf_populate_interface_from_header() to dynamically create interfaces. Free encap_priv on pcap_close. Ping-Bug: 12303 Change-Id: Ieda425ef3e50a124d9c38ee4538aa3644128ce60 Reviewed-on: https://code.wireshark.org/review/15362 Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2016-06-21Add support for Opencontrail virtual networkRudra Rugge3-1/+7
Change-Id: Ia6012e0f6425be069e222538eafb1191b398ec83 Reviewed-on: https://code.wireshark.org/review/15930 Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com> Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2016-06-16randpktdump: fix a crash.Dario Lombardo1-1/+1
Randpktdump requires the init the wtap opttypes. Fixed making the init function public and calling it. Bug: 12539 Change-Id: I02585c41012deacff1526b51ed09ab555cbfc8ce Reviewed-on: https://code.wireshark.org/review/15951 Petri-Dish: Anders Broman <a.broman58@gmail.com> Reviewed-by: Martin Kaiser <wireshark@kaiser.cx> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2016-06-16ip-over-ib description entry was missingRudra Rugge1-1/+3
Description entry was missing in the list. Change-Id: Ia8f8bd4608ee6800a352f4979752b5c45c4a5086 Reviewed-on: https://code.wireshark.org/review/15947 Reviewed-by: Michael Mann <mmann78@netscape.net> Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2016-06-16Export wtap_optionblock_copy_options() symbolPascal Quantin1-1/+1
It can be useful for wiretap plugins Change-Id: Ic56e4357ba3bfcef30d13615efc1361399c3133e Reviewed-on: https://code.wireshark.org/review/15955 Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
2016-06-15Remove Nmake build systemPascal Quantin2-83/+0
Change-Id: I3bd474f3cda9667dec66426b5729449953df3e61 Reviewed-on: https://code.wireshark.org/review/15777 Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Jörg Mayer <jmayer@loplof.de> Reviewed-by: Balint Reczey <balint@balintreczey.hu>
2016-06-15Don't map the interface ID for records that don't pertain to an interface.Guy Harris1-5/+11
And revert to the previous behavior of map_phdr_interface_id(); that change broke the mergecap tests when it was merging pcap files into a pcapng file. Change-Id: I2e079b0e87dce06e98faa9ab7615f9b9b2701b77 Reviewed-on: https://code.wireshark.org/review/15932 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-06-15wtap: Make default_filter staticStig Bjørlykke1-2/+1
Address of stack memory associated with local variable 'default_filter' is still referred to by the global variable 'filter_option' upon returning to the caller. This will be a dangling reference. Change-Id: I6160a37f05b8aea245b723ec50803e4062886738 Reviewed-on: https://code.wireshark.org/review/14427 Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2016-06-15More Sysdig / system event support.Gerald Combs3-3/+129
Add REC_TYPE_SYSCALL to wiretap and use it for Sysdig events. Call the Sysdig event dissector from the frame dissector. Create a "syscall" protocol for system calls, but add "frame" items to it for now. Add the ability to write Sysdig events. This lets us merge packet capture and syscall capture files. Change-Id: I12774ec69c89d8e329b6130c67f29aade4e3d778 Reviewed-on: https://code.wireshark.org/review/15078 Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2016-06-10More comment clarification.Guy Harris1-2/+4
That's not "the biggest record we're willing to write", it's "the biggest record the pcapng format supports, as the record length is a 16-bit field". Change-Id: Icbd5e0cc4ed8e2a3a0d474245a9b9ed2c999d520 Reviewed-on: https://code.wireshark.org/review/15818 Reviewed-by: Guy Harris <guy@alum.mit.edu> (cherry picked from commit 09de28933f9a17d4472206e1ac4b7c92001e44f5) Reviewed-on: https://code.wireshark.org/review/15820
2016-06-10Make the IPv4 NRB code's comments match the IPv6 NRB code's comments.Guy Harris1-1/+8
The IPv6 comments gave more details. Change-Id: I4e4d865feadbabfd625cdf2b2b162b99c4f23efa Reviewed-on: https://code.wireshark.org/review/15815 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-06-08Support reading in and storing multiple Section Header and Name Resolution ↵Michael Mann1-14/+8
blocks. The data is not applied anywhere, just stored. The first Section Header block is still the only one that is used to read a pcapng file. Change-Id: If9546401101d2fe79b2325bacbd597b92127e86e Reviewed-on: https://code.wireshark.org/review/15705 Reviewed-by: Michael Mann <mmann78@netscape.net> Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Jaap Keuter <jaap.keuter@xs4all.nl> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2016-06-07ERF: Make ERF wiretap forwards compatible.Anthony Coddington2-11/+6
Dissector has always been able to cope with unknown record types so pass them through (and call the data dissector from the ERF dissector in this case). Previously was stopping processing on the first unrecognized record which is very unhelpful for otherwise valid files that have new types mixed in. Remove ERF type check altogether from open heuristic as ERF type could be past 48 in future and with more extension headers bit any byte value could be valid. Also allow setting ERF_RECORDS_TO_CHECK to 0 to force skipping the heuristic. Change-Id: I8331eef30ba2e949564f418b3100bd73b8f58116 Reviewed-on: https://code.wireshark.org/review/15361 Reviewed-by: Michael Mann <mmann78@netscape.net> Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2016-06-06Move ip6_to_str_buf() to to_str.c and make it take the buffer length.João Valverde1-1/+1
Also make it use ws_inet_ntop6() (rather than implementing the string conversion ourselves). Remove ip6_to_str_buf_len(). Change-Id: I1eff3a8941e00987c2ff0c4dcfda13476af86191 Reviewed-on: https://code.wireshark.org/review/15692 Reviewed-by: João Valverde <j@v6e.pt> Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-06-06*_stdup_printf -> strdup for "single string only" formatting.Michael Mann9-17/+17
Done for performance improvements. This could probably be done in checkAPIs.pl, but this was just a quick manual check with grepping. Change-Id: I91ff102cb528bb00fa2f65489de53890e7e46f2d Reviewed-on: https://code.wireshark.org/review/15751 Reviewed-by: Michael Mann <mmann78@netscape.net> Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Jaap Keuter <jaap.keuter@xs4all.nl>
2016-06-06Add a routine to get an array of all instances of a string option.Guy Harris2-0/+41
Use it for OPT_COMMENT in the SHB, as there may be ore than one instance of OPT_COMMENT in an SHB. Also, use wtap_optionblock_get_option_string for OPT_SHB_HARDWARE, OPT_SHB_OS, and OPT_SHB_USERAPPL; they're specified as "only one instance allowed". Change-Id: I23ad87e41e40b7ae1155e96c0523a6f8caad5204 Reviewed-on: https://code.wireshark.org/review/15750 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-06-06Directly use wtap_opttypes calls to fetch SHB options.Guy Harris2-87/+96
Don't put them in the summary structure; the summary routines should calculate summary statistics, not dig up every bit of information that *could* appear in a summary. Instead, have the GUI code call wtap_file_get_shb() to get the SHB information and call wtap_optionblock_get_option_string() to fetch the option values. Move the option code definitions into wtap_opttypes.h, as they're used by the API. Change-Id: Icef11f5fb30fdc3df1bb0208aae9ed0aebaf0182 Reviewed-on: https://code.wireshark.org/review/15748 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-06-01Add data structures necessary to support multiple Name Resolution blocks.Michael Mann5-35/+47
This doesn't try to use any data from multiple Name Resolution blocks, it just converts single Name Resolution block usage into a GArray, so the potential is there to then use/support multiple Name Resolution blocks within a file format (like pcapng) Change-Id: Ib0b584af0bd263f183bd6d31ba18275ab0577d0c Reviewed-on: https://code.wireshark.org/review/15684 Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-06-01Add data structures necessary to support multiple Section Header blocks.Michael Mann11-82/+112
This doesn't try to use any data from multiple Section Header blocks, it just converts single Section Header block usage into a GArray, so the potential is there to then use/support multiple Section Header blocks within a file format (like pcapng) Change-Id: I6ad1f7b8daf4b1ad7ba0eb1ecf2e170421505486 Reviewed-on: https://code.wireshark.org/review/15636 Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-06-01Allow create_tempfile to support a suffix.Michael Mann2-2/+2
Ping-Bug: 10203 Change-Id: Ifa24870d711449b87e9839dd46af614e4aa28fde Reviewed-on: https://code.wireshark.org/review/15608 Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Martin Mathieson <martin.r.mathieson@googlemail.com>
2016-06-01Register a few more file extensions as belonging to Wireshark.Jeff Morriss1-2/+2
Register Wireshark for PacketLogger, ERF, IPFIX, and VWR files on freedesktop.org, OS X, and Windows (we were already registered for ERF and VWR files on Windows). Change-Id: I8105997cb15ea06e1c078489fd88763d4ce9e40c Reviewed-on: https://code.wireshark.org/review/15635 Petri-Dish: Jeff Morriss <jeff.morriss.ws@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2016-05-31Suggest that file types should also be registered in the WiX installer.Jeff Morriss1-2/+2
Change-Id: If65ff14589ccd0b2d643256f3443dc26b3b71371 Reviewed-on: https://code.wireshark.org/review/15640 Reviewed-by: Jeff Morriss <jeff.morriss.ws@gmail.com>
2016-05-30If routines return a wtap_opttype_return_val, declare them as doing so.Guy Harris2-48/+68
Also, improve the doxygen comments. Change-Id: I57929dfba23d926fd806ac001a5a3924bb636ae0 Reviewed-on: https://code.wireshark.org/review/15634 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-05-30Copy all options when creating SHB block for new file.Michael Mann1-4/+1
Change-Id: I666d4f546d9fdc026ccd7fac7750e80df7f9b697 Reviewed-on: https://code.wireshark.org/review/15611 Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2016-05-28Make wtap_optionblock_foreach_option public.Guy Harris1-1/+1
Change-Id: I99e448319669acfdb0ec3b96e8e1195ba4a1f4f9 Reviewed-on: https://code.wireshark.org/review/15594 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-05-26Remove write capabilities from wtap_optionblocks.Michael Mann3-457/+635
The write functionality was too PCAPNG-specific and the intention is to keep the option blocks as generic as possible. So moved the write functionality back to pcapng.c and added a wtap_opttype API to loop through all options in the block (wtap_optionblock_foreach_option) Change-Id: Iaf49126a1a3e2ed60ae02c52878ca22671dac335 Reviewed-on: https://code.wireshark.org/review/15525 Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-05-22Add wtap_optionblock_set_option_string_formatMichael Mann9-95/+95
Also add a length parameter to wtap_optionblock_set_option_string Change-Id: I8c7bbc48aa96b5c2a91ab9a17980928d6894f1ee Reviewed-on: https://code.wireshark.org/review/15505 Reviewed-by: Anthony Coddington <anthony.coddington@endace.com> Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-05-22ERF: Fix and improve ERF_TYPE_META sanity checksAnthony Coddington1-3/+6
Fix sanity checking overflow in wiretap ERF_TYPE_META parsing segfault. Fix final tag of exactly 4 bytes not being dissected. Fix not setting bitfield tag subtree (was working due to proto.c internal behaviour). Add dissector expertinfo for truncated tags. Dissect type and length on error. Bug: 12352 Change-Id: I3fe6644f369e4d6f1f64270cb83c8d0f8a1f1a94 Reviewed-on: https://code.wireshark.org/review/15357 Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-05-21wtap_opttypes: fix no previous prototype for function ↵Alexis La Goutte1-1/+1
'wtap_opttype_write_data_uint64_timestamp' [-Wmissing-prototypes] Change-Id: I36244dee9cd5667d498ab0a4ba98b83e8fe84ac8 Reviewed-on: https://code.wireshark.org/review/15514 Reviewed-by: Anders Broman <a.broman58@gmail.com>
2016-05-21Add ability to add custom block types.Michael Mann2-13/+50
Change-Id: I2d23148c6f8d847aacec1d25cb694793ec9bb84e Reviewed-on: https://code.wireshark.org/review/15504 Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-05-19autotools: Add automake silent rule for ln -sJoão Valverde1-1/+1
Change-Id: Ic5b6fca04955384dc3d337ec74757f711216a372 Reviewed-on: https://code.wireshark.org/review/15468 Petri-Dish: Jeff Morriss <jeff.morriss.ws@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Jeff Morriss <jeff.morriss.ws@gmail.com>
2016-05-17Correctly write out the isb_startime and isb_endtime options.Guy Harris1-2/+17
They're not marshalled as a 64-bit integer in pcapng files, they're marshelled as 2 32-bit integers, the first of which is the upper 64 bits of the value and the second of which is the lower 64 bits of the value. Bug: 12349 Change-Id: I2bde51ac11b2518ef2ddaecf43672c984f26081a Reviewed-on: https://code.wireshark.org/review/15492 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-05-17opa: Add dissectors for Intel’s Omni-Path Architecture (OPA)Adam Goldman2-0/+4
Added dissectors for OPA Fabric Executive (FE) Header, OPA Snoop and Capture (SnC) MetaData Header, OPA 9B Packets, and OPA MAD Packets. Bug: 12114 Change-Id: I6acd3c9e266e4b638167abbdd275ec7c1d472b4f Reviewed-on: https://code.wireshark.org/review/13473 Reviewed-by: Adam Goldman <adam.goldman@intel.com> Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com> Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-05-15pcap-common: Account for padding in ENCAP_ERF len and caplenAnthony Coddington1-1/+20
Set len and caplen in pcap_read_post_process to actual wlen/payload length like for native ERF. This fixes padding incorrectly showing as an Ethernet trailer or equivalent as well as packet length calculations being incorrect. Fix up rlen when writing ENCAP_ERF so it isn't longer than the actual record length. This differs from native ERF behaviour which pads the record instead but there is currently no non-hackish way to do this for pcap/pcap-ng. Note: This means records captured from a DAG card in Wireshark (or old PCAP(-NG) files opened) will have padding stripped when saved as PCAP(-NG) and thus cannot be transmitted when converted to native ERF without aligning first. However, if the file is saved as native ERF originally the padding will be preserved (and zeroed). Given that extension header write support was very broken and transmission of PCAP(-NG) is not supported without conversion this is not expected to have been common. Ping-Bug: 3606 Change-Id: I49dce03984d7f07431b6eb7e16a993aeb571f288 Reviewed-on: https://code.wireshark.org/review/15359 Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-05-14mp2t (CID 1355406): fix a potential integer overflowMartin Kaiser1-1/+4
cast one of the factors to uint64 to make sure that the calculation uses uint64 and not uint32 which may overflow Change-Id: Iec14f870a694008f5a734294d9154117b6c64b78 Reviewed-on: https://code.wireshark.org/review/15346 Petri-Dish: Jaap Keuter <jaap.keuter@xs4all.nl> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Martin Kaiser <wireshark@kaiser.cx>
2016-05-12pcap-common: Fix several serious ENCAP_ERF extension header writing issuesAnthony Coddington1-8/+29
Write ERF subheader after extension headers, especially important for Ethernet (other types predate extension headers for the most part). Add missing ERF_TYPE_MC_AAL2 and ERF_TYPE_COLOR_HASH_ETH. Truncate final ERF extension header when too many. Rlen is not currently adjusted so may be incorrect (see followup patch). Existing tools generally check against PCAP incl_len anyway as there are other scenarios where this can happen like naive snapping or Wireshark ERF-to-PCAP. Properly fixing this will involve getting rid of the ERF pseudoheader. Consistent with the ERF wiretap (except for different padding behaviour). Bug: 3606 Change-Id: I6086cbc3fef948586fbad6f585f648d99adfff4f Reviewed-on: https://code.wireshark.org/review/15358 Reviewed-by: Michael Mann <mmann78@netscape.net> Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-05-11automake/nmake: don't run checkAPIs on lex and yacc files.Jeff Morriss2-3/+2
The lex files use malloc and friends which is prohibited; don't check them (until checkAPIs becomes smart enough to realize this is OK). This mirrors what is done in cmake. Change-Id: Ie80ea7a9b7c0e25c70c8edf3671e80a493ea1b2f Reviewed-on: https://code.wireshark.org/review/15377 Petri-Dish: Jeff Morriss <jeff.morriss.ws@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-05-04wiretap: fix writing of 1 bytes long options in pcapng filesPascal Quantin1-3/+8
the option length should be 1 byte, not 4 bytes. Change-Id: I1b356c7ce101f9bbdc9793fc280b6564e12f303f Reviewed-on: https://code.wireshark.org/review/15265 Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com> Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-05-02Add checkAPI calls to CMake.Graham Bloice1-2/+17
This generates a top level target, checkAPI, that is excluded from the ALL build target, so must be run separately. On Windows using a Visual Studio generator, call msbuild /p:Configuration=RelWithDebInfo checkAPI.vcxproj Change-Id: I44a57c564dcfc75499463b942436f4b920a82478 Reviewed-on: https://code.wireshark.org/review/14873 Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Graham Bloice <graham.bloice@trihedral.com>
2016-05-02Another "this is < WTAP_MAX_PACKET_SIZE so no checks are needed" note.Guy Harris1-0/+4
Change-Id: Ie46a141b1e41ee855defe60eba9137718770df9b Reviewed-on: https://code.wireshark.org/review/15241 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-05-02Remove trailing blank.Guy Harris1-1/+1
Change-Id: I57017b3e574983dac9107712a0dd6b243b62bb80 Reviewed-on: https://code.wireshark.org/review/15240 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-05-02Add some more checks, clean up length handling.Guy Harris1-6/+49
Check for destination or source MAC addresses that aren't 12 characters (hex dump of 6 octets) long and type/length fields that aren't 4 characters (hex dump of 2 octets) long. The buffer into which we copy the hex dump characters doesn't need to be null-terminated, so don't bother to null-terminate it. Use the final offset into the buffer as the buffer length, rather than using strlen(). Just memcpy the MAC addresses and type/length fields into the buffer; the buffer is guaranteed to be big enough for all of them, and, as noted, it doesn't need to be null-terminated. Change-Id: I790e953542ae8443af01c81229a8deb877448ee3 Reviewed-on: https://code.wireshark.org/review/15239 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-05-02Don't assume packets will be no larger than ISERIES_MAX_PACKET_LEN.Guy Harris1-8/+6
We don't check against it. Insteead, use phdr->caplen as the buffer size; that's based on the number of hex digits we've found. While we're at it, also get rid of ISERIES_PKT_ALLOC_SIZE - it makes it less obvious that it's based on the packet length from the packet header. Change-Id: I8ad6306c62e7bc4cf896b335f39a5a77780fb2ea Reviewed-on: https://code.wireshark.org/review/15236 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-05-02Make sure the packet length isn't > WTAP_MAX_PACKET_SIZE.Guy Harris1-0/+18
Change-Id: I65c1e87e2fcff93b3db998666ff51f19ecd71b55 Reviewed-on: https://code.wireshark.org/review/15233 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-05-01Don't treat the packet length as unsigned.Guy Harris1-3/+7
The scanf family of functions are as annoyingly bad at handling unsigned numbers as strtoul() is - both of them are perfectly willing to accept a value beginning with a negative sign as an unsigned value. When using strtoul(), you can compensate for this by explicitly checking for a '-' as the first character of the string, but you can't do that with sscanf(). So revert to having pkt_len be signed, and scanning it with %d, but check for a negative value and fail if we see a negative value. Bug: 12394 Change-Id: I4b19b95f2e1ffc96dac5c91bff6698c246f52007 Reviewed-on: https://code.wireshark.org/review/15230 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-05-01Don't treat the packet length as unsigned.Guy Harris1-4/+8
The scanf family of functions are as annoyingly bad at handling unsigned numbers as strtoul() is - both of them are perfectly willing to accept a value beginning with a negative sign as an unsigned value. When using strtoul(), you can compensate for this by explicitly checking for a '-' as the first character of the string, but you can't do that with sscanf(). So revert to having pkt_len be signed, and scanning it with %d, but check for a negative value and fail if we see a negative value. Bug: 12395 Change-Id: I43b458a73b0934e9a5c2c89d34eac5a8f21a7455 Reviewed-on: https://code.wireshark.org/review/15223 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-05-01Don't treat the packet length as unsigned.Guy Harris1-3/+8
The scanf family of functions are as annoyingly bad at handling unsigned numbers as strtoul() is - both of them are perfectly willing to accept a value beginning with a negative sign as an unsigned value. When using strtoul(), you can compensate for this by explicitly checking for a '-' as the first character of the string, but you can't do that with sscanf(). So revert to having pkt_len be signed, and scanning it with %d, but check for a negative value and fail if we see a negative value. Bug: 12396 Change-Id: I54fe8f61f42c32b5ef33da633ece51bbcda8c95f Reviewed-on: https://code.wireshark.org/review/15220 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-05-01Don't treat the packet length as unsigned.Guy Harris1-4/+9
The scanf family of functions are as annoyingly bad at handling unsigned numbers as strtoul() is - both of them are perfectly willing to accept a value beginning with a negative sign as an unsigned value. When using strtoul(), you can compensate for this by explicitly checking for a '-' as the first character of the string, but you can't do that with sscanf(). So revert to having pkt_len be signed, and scanning it with %d, but check for a negative value and fail if we see a negative value. Change-Id: I6450d468504e942df72342176a0e145e5ac3db5f Reviewed-on: https://code.wireshark.org/review/15216 Reviewed-by: Guy Harris <guy@alum.mit.edu>