aboutsummaryrefslogtreecommitdiffstats
path: root/wiretap
AgeCommit message (Collapse)AuthorFilesLines
2016-04-25Fix nmake build after statically linking version codeMichael Mann1-1/+1
Change-Id: I86a01bdd778f2242aa534a687275a85a2f329c02 Reviewed-on: https://code.wireshark.org/review/15071 Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-04-25mplog: fix 'err_info' was marked unused but was used ↵Alexis La Goutte1-1/+1
[-Werror,-Wused-but-marked-unused] Change-Id: Ifbbd9d264c7d75b6df754ca9834de5e415b97796 Reviewed-on: https://code.wireshark.org/review/15080 Reviewed-by: Anders Broman <a.broman58@gmail.com>
2016-04-22Add CMake version.h dependencyJoão Valverde1-0/+2
Remove the need for version.h.in and bring CMake up to par with autotools. Change-Id: I701b56c475f5fdec1f9a028536fff6992ce8eaca Reviewed-on: https://code.wireshark.org/review/15031 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-04-22Add mplog to the list of file extensions understood by Wireshark.Jeff Morriss1-0/+1
By putting it in this list the File->Open dialog will include an option for *.mplog files. Change-Id: Icf6480f7be1023650262fc1f3996a390e137cb88 Reviewed-on: https://code.wireshark.org/review/15048 Petri-Dish: Jeff Morriss <jeff.morriss.ws@gmail.com> Reviewed-by: Martin Kaiser <wireshark@kaiser.cx> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2016-04-21Link version code statically againJoão Valverde3-3/+11
This allows keeping the code-sharing with the static linking. This "fixes" a hypothetical ABI mismatch with wsutil and avoids pulling more external dependencies to wsutil than strictly necessary. A nice side-effect is that libwsutil no longer depends on version.h. Follow up to f95976eefcbeb5d24df383c29d29ef888b503945. Change-Id: I8f0d6a557ab3f7ce6f0e2c269124c89f29d6ad23 Reviewed-on: https://code.wireshark.org/review/15002 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-04-19wtap: fix leak in optionblock management.Dario Lombardo1-2/+5
Found by valgrind: ==14298== at 0x4C2CE8E: realloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==14298== by 0xA66C6AE: g_realloc (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.4002.0) ==14298== by 0xA63BB32: ??? (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.4002.0) ==14298== by 0xA63BEB7: g_array_append_vals (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.4002.0) ==14298== by 0xA193252: wtap_optionblock_add_option (wtap_opttypes.c:352) ==14298== by 0xA19361C: shb_create (wtap_opttypes.c:607) ==14298== by 0xA192F96: wtap_optionblock_create (wtap_opttypes.c:126) ==14298== by 0xA168784: wtap_open_offline (file_access.c:824) ==14298== by 0x11D47C: cf_open (tshark.c:4194) ==14298== by 0x117852: main (tshark.c:2183) et al. Change-Id: Ic16595ed3c12b9ed6c2813852ceb594c29ece929 Reviewed-on: https://code.wireshark.org/review/15004 Petri-Dish: Dario Lombardo <lomato@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Evan Huus <eapache@gmail.com> Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-04-19Call the buffer for the magic number "magic".Guy Harris1-3/+3
It's not guaranteed to be a C string, so don't call it "str". Change-Id: I614ccf4f87b9f6f58d9b72596827224006f1de30 Reviewed-on: https://code.wireshark.org/review/14998 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-04-19Distinguish between read errors and short reads when opening.Guy Harris1-2/+5
Use wtap_read_bytes() which will return WTAP_ERR_SHORT_READ if we don't get the specified number of bytes. Treat all errors *other* than WTAP_ERR_SHORT_READ as an I/O error. Change-Id: If38b5ad1b142441f2f2dd356be196bf381058da4 Reviewed-on: https://code.wireshark.org/review/14997 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-04-19Open routines are called with the seek pointer at the beginning.Guy Harris1-4/+0
There's no need for an open routine to seek back to the beginning of the file - the file open code has done that already. Change-Id: I4053474e60e7c8e8f59a89503d4bb08499d9399e Reviewed-on: https://code.wireshark.org/review/14996 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-04-19Detect and handle EOFs in the middle of a packet.Guy Harris1-2/+15
And *any* EOFs in the seek-read routine. Change-Id: I5742c7bbd782e59e9c64e4821f22c706ddbc5382 Reviewed-on: https://code.wireshark.org/review/14995 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-04-19Use memcmp() to check the magic number.Guy Harris1-2/+2
We just care whether the first 6 bytes of the file are "MPCSII"; memcmp() will do that, and we don't have to worry about NULs. Change-Id: I03872c30e76eedce67577657270e36f0795e74bd Reviewed-on: https://code.wireshark.org/review/14994 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-04-18wiretap: add support for the mplog capture file formatMartin Kaiser6-0/+300
the mplog format is used by some commercial logging tools that capture ISO 14443 traffic between a card reader and a contactless smartcard Change-Id: If359b8f0f671eb2a7c6315e2b8960a5bd581a9e9 Reviewed-on: https://code.wireshark.org/review/14950 Reviewed-by: Martin Kaiser <wireshark@kaiser.cx>
2016-04-17Fix "2nd byte of optional tags bitmap" flag values.Guy Harris1-2/+2
The presence bits field isn't made up of multiple bytes, it's a single 32-bit field, so move the bit values up 8 bits so they don't collide with the values from the first byte. Prevents a crash with at least one 32.423 file. Change-Id: I804e76a5b8844f1f3894a43af7fd8bbe9fa7447c Reviewed-on: https://code.wireshark.org/review/14943 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-04-13Windows: Remove the need for _CRT_NONSTDC_NO_DEPRECATE.Gerald Combs1-2/+2
Replace some function calls with their non-deprecated equivalents so that we can remove _CRT_NONSTDC_NO_DEPRECATE from CMakeLists.txt and config.nmake. Leave _CRT_SECURE_NO_DEPRECATE in place. Removing it failed with 145 warnings and 72 errors. Note that we could probably improve startup performance by using wmem in diam_dict.*. Change-Id: I6e130003de838aebedbdd1aa78c50de8a339ddcb Reviewed-on: https://code.wireshark.org/review/14883 Reviewed-by: Gerald Combs <gerald@wireshark.org> Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-04-05Set the extra type the right way.Guy Harris3-2/+6
Use %option extra_type= rather than #defining YY_EXTRA_TYPE. Change comments to reflect that the state structure is used both by the lexical analyzer and the parser. Change-Id: I19a81de61cbd6e86d71154f376ef0681cc6d42fb Reviewed-on: https://code.wireshark.org/review/14826 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-04-05[ERF] g_list_free_full () is glib >= 2.28, g_hash_table_add is >= 2.32AndersBroman1-5/+18
change to supported functions. Change-Id: Ic088b835d05dce4a1b9b7a102cab89be44da46d6 Reviewed-on: https://code.wireshark.org/review/14819 Petri-Dish: Anders Broman <a.broman58@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2016-04-04Include ws_diag_control.h in config.hJoão Valverde2-4/+2
Change-Id: Ia394071710ecda3b0e6686a51fbca45a8ff20317 Reviewed-on: https://code.wireshark.org/review/14749 Petri-Dish: João Valverde <j@v6e.pt> Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: João Valverde <j@v6e.pt>
2016-04-04Rename "libz" to "zlib"João Valverde3-27/+27
Change-Id: I12f92c983d587c2a4751428cdf299635090c9f0b Reviewed-on: https://code.wireshark.org/review/14748 Reviewed-by: João Valverde <j@v6e.pt> Petri-Dish: João Valverde <j@v6e.pt> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2016-04-03Fix #defines.Guy Harris1-3/+3
Change-Id: I0fcd865d686d50ae9be17e97a4495daebc4bc4fc Reviewed-on: https://code.wireshark.org/review/14801 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-04-03Make the Flex scanners and YACC parser in libraries reentrant.Guy Harris6-408/+563
master-branch libpcap now generates a reentrant Flex scanner and Bison/Berkeley YACC parser for capture filter expressions, so it requires versions of Flex and Bison/Berkeley YACC that support that. We might as well do the same. For libwiretap, it means we could actually have multiple K12 text or Ascend/Lucent text files open at the same time. For libwireshark, it might not be as useful, as we only read configuration files at startup (which should only happen once, in one thread) or on demand (in which case, if we ever support multiple threads running libwireshark, we'd need a mutex to ensure that only one file reads it), but it's still the right thing to do. We also require a version of Flex that can write out a header file, so we change the runlex script to generate the header file ourselves. This means we require a version of Flex new enough to support --header-file. Clean up some other stuff encountered in the process. Change-Id: Id23078c6acea549a52fc687779bb55d715b55c16 Reviewed-on: https://code.wireshark.org/review/14719 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-04-03Include json.h with quotes, not angle brackets.Guy Harris1-1/+1
Change-Id: I9fdb38ca724ec1a76126a956c7f7b07fd4c1ddb0 Reviewed-on: https://code.wireshark.org/review/14798 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-04-03Use quotes, not angle brackets, for wtap-int.h and file_wrappers.h.Guy Harris1-2/+2
This is consistent with what the rest of the files do, and doesn't require that the compiler explicitly be told to treat the current directory as an include directory. Change-Id: Iefaedd2acc936f45d5095546f8dea7167d2e88c8 Reviewed-on: https://code.wireshark.org/review/14797 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-04-03Don't deref before NULL check on pointer (CID-1358044)Jaap Keuter1-2/+5
When the state pointer is NULL it's defensively coded against by a NULL pointer check. Variable initialization before should then not dereference that pointer. Change-Id: I0ed09e2f22be5651324f43fc3fd339d2f95684c0 Reviewed-on: https://code.wireshark.org/review/14776 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-04-03Don't use <wtap.h> to refer to the main libwiretap header file.Guy Harris34-34/+34
Either use "wtap.h", if it's only for files in the wiretap directory, or <wiretap/wtap.h>, if it's also a header that stuff outside libwiretap can include. Change-Id: If1c71b3dae9a3c0d64661ae1734f925319e447d1 Reviewed-on: https://code.wireshark.org/review/14788 Petri-Dish: Guy Harris <guy@alum.mit.edu> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-04-01ERF: Add dissection and wiretap support for ERF_TYPE_META.Anthony Coddington2-13/+1320
ERF Dissector: Add dissection for ERF_TYPE_META, Host ID and Flow ID extension headers. Rename ERF extension header defines to ERF_EXT_HDR* and put in erf.h. The Flow ID extension header has an improved 32-bit Flow Hash with a Hash Type field describing what the hash was computed over. The Host ID extension header contains a 48-bit organizationally unique Host Identifier. Both extension headers contain the same 8-bit Source ID used for distinguishing records from multiple sources in the same file and for metadata linking to ERF_TYPE_META records. Host ID is used to identify the capturing host and can also be used to distinguish records from multiple hosts in the same file. ERF_TYPE_META records have a payload consisting of TLV metadata, divided into sections which define the context of the TLV tag. The dissector registers a field for each tag for each section type based on a template. ERF_TYPE_META records generally have a Host ID extension header used to link metadata to packet records with the same Host ID and Source ID. The associated Host ID can either be explicit on all records, or implicit where the Host ID extension header is only present on MetaERF records and other records are associated using only the Source ID in the Flow ID extension header. Includes per-record generated Source summary and frame linking. These have the 'correct' Host ID and Source IDs from either extension header, including applying the Implicit Host ID, and links to the most recent ERF_TYPE_META record. Relies on Wireshark doing more than one pass to associate the correct implicit Host ID tree items for records before the first ERF_TYPE_META record. The metadata is technically not associated at that point anyway. ERF Wiretap: Add per-HostID/per-SourceID wtap interfaces and basic ERF_TYPE_META support. Adds read support for displaying some fields of the 'first' ERF_TYPE_META record in the Capture File Properties screen. Concatenates and merges some summary fields to provide more useful information and attempt to combine ERF sources, streams and interfaces into wtap interfaces. Interface naming gracefully degrades when Host ID and Source ID are not present and is intended to be parseable for use by DAG software. Supports Implicit Host ID, but assumes it does not change. NOTE: Now only ERF interfaces that are present in the file are added. Only works with native ERF files for now. Written such that it is easily adapted for use by pcap dissector. Some support for setting REC_TYPE_FT_SPECIFIC_REPORT on MetaERF records. Disabled for now as this breaks pcapng_dump saving of ERF_TYPE_META and ft_specific_record_phdr clashes with erf_mc_phdr. Only when native ERF file (as uses wth->file_type_subtype). Register packet-erf as a dissector of WTAP_FILE_TYPE_SUBTYPE_ERF. Bug: 12303 Change-Id: I6a697cdc851319595da2852f3a977cef8a42431d Reviewed-on: https://code.wireshark.org/review/14510 Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com> Tested-by: Alexis La Goutte <alexis.lagoutte@gmail.com> Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-04-01support for IP-over-Infiniband - pcap encapsulationPetr Sumbera3-3/+4
Bug: 12279 Change-Id: Ib6c54f8b86d95c5546bc800749f124cd0dbb8ff0 Reviewed-on: https://code.wireshark.org/review/14585 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>
2016-03-31[Nettrace] Add parsing of some HSS records.AndersBroman1-11/+138
Change-Id: I7c2f6ebdb20f90533ee008e1b4557ef27d4672dc Reviewed-on: https://code.wireshark.org/review/14708 Petri-Dish: Anders Broman <a.broman58@gmail.com> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2016-03-29Assorted cleanups.Guy Harris1-17/+29
1) Handle the ASCII and Unicode magic numbers the same way - as static const char arrays. Note that Unicode specifically means little-endian UCS-2 (or UTF-16, but they probably use few if any characters outside of ASCII, much less the Basic Multilingual Plane). 2) Treat all seek errors as open errors rather than "not my file type". 3) Fix capitalization of "Unicode". Change-Id: I47b7e057ccada00347499a6b17f8f8fc44e7c503 Reviewed-on: https://code.wireshark.org/review/14689 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-03-28Fix some warnings/errors of typeJoerg Mayer6-8/+22
git/epan/dissectors/packet-a21.c:478:25: error: 'item' was marked unused but was used [-Werror,-Wused-but-marked-unused] proto_item_append_text(item, "%s", val_to_str_const(event_id, a21_event_vals, "Unknown")); ^ Added manual change id because file-jpeg.c forced the use of commit -n Change-Id: Iffff53d6253758c8454d9583f0a11f317c8390cb Reviewed-on: https://code.wireshark.org/review/14666 Reviewed-by: Jörg Mayer <jmayer@loplof.de>
2016-03-27Treat Gammu DCT3 trace files as having magic numbers.Guy Harris1-1/+2
Otherwise, they get treated as generic XML files. No, a standard XML tag, followed by <dump>, isn't a *perfect* magic number, but if you *really* want to read it as a generic XML file, you can do so from the UI. (This is just like TNEF files.) Change-Id: I7624023ecf87a21ef339222c89b3c9abd7acc727 Reviewed-on: https://code.wireshark.org/review/14656 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-03-24Add files by folder to distribution tarball (EXTRA_DIST)João Valverde1-0/+1
This takes away much of the pain (and merge conflicts) of micro-managing every sub-folder file. Change-Id: I7d7bb1173511ec9312ca4a97c6a59a26b0b194f4 Reviewed-on: https://code.wireshark.org/review/14595 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-03-23Add pkg.m4 and remove aclocal-flags scriptJoão Valverde1-2/+0
Add pkg-config 0.29.1 macros to our distribution. This makes the aclocal-flags script obsolete, since we are already not using GLib autoconf macros. ACLOCAL_AMFLAGS need only be defined on the top-level Makefile.am. Change-Id: Idd868dcfeb8f279517970d0f96d9d53e3a7e4d5c Reviewed-on: https://code.wireshark.org/review/14568 Reviewed-by: João Valverde <j@v6e.pt>
2016-03-09Initialize write function pointers when copying a new wtap block option.Michael Mann1-0/+2
Issue found by Clang (Assigned value is garbage or undefined). Change-Id: I9a3ab41dd01becbd454af02f2567ea3a2beeba40 Reviewed-on: https://code.wireshark.org/review/14399 Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2016-03-08Add EditorConfig settings for most C filesJoão Valverde2-0/+146
Change-Id: I02e6d71290bbdf7504437b0d670955b3686b6b52 Reviewed-on: https://code.wireshark.org/review/14360 Reviewed-by: João Valverde <j@v6e.pt>
2016-03-06Fix indentation.Guy Harris1-23/+23
Change-Id: I78fd1d8e91443fa878e6c4ae05839d8a49849830 Reviewed-on: https://code.wireshark.org/review/14367 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-03-06Improve wiretap block capabilities.Michael Mann4-1064/+725
Make a more formal method for registering options within a block and do it all with a single function (wtap_optionblock_add_block). Add ability for block to be able to write itself, refactored out of pcapng.c. This was implemented for SHB, ISB, and IDB blocks. Name resolution (NRB), while possible, seemed a little messy for the moment. Change-Id: Ie855c8550c7c7d96cfc188c0cd90bfbc4d5f0ee8 Reviewed-on: https://code.wireshark.org/review/14357 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-03-03Refactor wiretap option block types into a registration system.Michael Mann2-190/+261
Also required mergecap to look for plugins to initialize wiretap option blocks. Change-Id: I4208d1028dd0f94f185393801d72025329266cb7 Reviewed-on: https://code.wireshark.org/review/14300 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-03-03Allocate GArray when copying stat blocks within IDB block.Michael Mann1-1/+1
Don't treat it like a GList Bug: 12220 Change-Id: I057649a26d135516c6e8d4fb028c6cb9dcda2e7c Reviewed-on: https://code.wireshark.org/review/14326 Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-03-03Revert "autotools: Use explicit zlib dependency build flags"João Valverde1-7/+2
This reverts commit 2bded0b66137a2f1c8b69911d91903a24f8a2624. Change-Id: Ic898c65df4daaa395eb010e0286d97509346d43a Reviewed-on: https://code.wireshark.org/review/14318 Reviewed-by: João Valverde <j@v6e.pt>
2016-03-03autotools: Use explicit zlib dependency build flagsJoão Valverde1-2/+7
Use pkg-config if a zlib.pc file is available. Remove the now redundant AC_TRY_LINK_FUNC test (there are no linker flags for GTK+ here). Change-Id: I7de744749eba7231ae0097b975144b76ffcf1bdb Reviewed-on: https://code.wireshark.org/review/14263 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-03-01NULL check GArray to prevent assertion.Michael Mann1-1/+2
Change-Id: I52de10a1d96b6ef7294ad8be9ec9195defca4b53 Reviewed-on: https://code.wireshark.org/review/14266 Petri-Dish: Michael Mann <mmann78@netscape.net> Reviewed-by: Graham Bloice <graham.bloice@trihedral.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-03-01Prevent use-after-free issues with pcapng.c/wtap_opttypes.cMichael Mann3-11/+14
Bug: 12173 Change-Id: Ifff28491073d50e088b26847830a3bc8835f4282 Reviewed-on: https://code.wireshark.org/review/14180 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-02-27wtap (opttypes.h): fix no newline at end of file [-Wnewline-eof]Alexis La Goutte1-1/+2
Change-Id: I5bdd42bce983cd874597f4675afe4c8b2790e0f6 Reviewed-on: https://code.wireshark.org/review/14196 Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com> Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-02-26Ensure we have a name resolution block when parsing its block type.Michael Mann1-1/+6
Bug: 12174 Change-Id: I82eb0ac75f2e03f15c2f016e9b7ff72fdc7044f5 Reviewed-on: https://code.wireshark.org/review/14179 Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-02-25Clean up modelines and indentation.Guy Harris3-5/+5
HT tab stops are set every 8 spaces on UN*X; UN*X tools that treat an HT character as tabbing to 4-space tab stops, or that even are configurable but *default* to 4-space tab stops (I'm looking at *you*, Xcode!) are broken. tab-width: 4, tabstop=4, and tabSize=4 are errors if you ever expect anybody to look at your file with a UN*X tool, and every text file will probably be looked at by a UN*X tool at some point, so Don't Do That. Adjust indentation to reflect the mode lines. Change-Id: Icf0831717de10fc615971fa1cf75af2f1ea2d03d Reviewed-on: https://code.wireshark.org/review/14150 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-02-25An SHB with a magic of 0x1A2B3C4D isn't necessarily little-endian.Guy Harris1-2/+2
If it's 0x1A2B3C4D, that means it has the same byte order as the instruction set for which Wireshark was built[*]; if it's 0x4D3C2B1A, it means it has the opposite byte order. (We assume no "middle-endian" machines here; it's extremely unlikely that any of this code will ever work on a PDP-11.) Wireshark *does* work on big-endian machines (if there are any places where it doesn't, those are bugs that must be fixed), so we can't assume that "same byte order as our instruction set" means "little-endian". [*]If, for example, you run a PowerPC binary under Rosetta, it'll act as if big-endian is the native byte order, even though it's running on a little-endian machine. Change-Id: Ic438bd85c034f1fba276408ba30214d7078121d1 Reviewed-on: https://code.wireshark.org/review/14133 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-02-25For SHBs, always use the byte order from the byte-order magic.Guy Harris1-19/+36
Don't use the byte order from any previously-seen SHB, as it might be different. Bug: 12167 Change-Id: I19a81f81f2e8115938387487e2682b8b11a100fe Reviewed-on: https://code.wireshark.org/review/14131 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-02-25Fix allocation of option bocks in pcapng_read().Guy Harris1-2/+3
We don't need to allocate an WTAP_OPTION_BLOCK_IF_DESCR option block; don't use the value we allocated. We must not allocate an WTAP_OPTION_BLOCK_IF_STATS option block until we need it, as we may have to allocate *more than one* of them here! The old code would reuse the same block, adding it more than once, causing a "freeing already freed data"/"freeing non-allocated data" error on some platforms. Change-Id: I8582627c1f5deecfd4f6490dcdf8c31ee3809d12 Reviewed-on: https://code.wireshark.org/review/14130 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-02-24Fix another heap-based bufffer overflow.Guy Harris1-10/+12
The S1 code works similarly to the S2/S3 code, and has the same issue. Change-Id: I288e30ccdf67d8a6daec8c8428c0f703e18ecc89 Reviewed-on: https://code.wireshark.org/review/14127 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-02-24Add 1 byte and 16 byte as separate values.Guy Harris1-2/+2
The 1 is for the byte written with vht_ndp_flag; the 16 is for the PLCP header. Separate them out; no change to the actual code (as any compiler worth its salt would do constant folding). Change-Id: I5e081c67e605203153270ed9a3f9e30b9e9b968c Reviewed-on: https://code.wireshark.org/review/14125 Reviewed-by: Guy Harris <guy@alum.mit.edu>