aboutsummaryrefslogtreecommitdiffstats
path: root/wiretap
AgeCommit message (Collapse)AuthorFilesLines
2015-12-31Don't cast away constness.Guy Harris1-11/+51
Change-Id: I529d37e57b12fa7515f2bd18a013618b50300231 Reviewed-on: https://code.wireshark.org/review/12974 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-12-24Refactor 802.11 radio flags.Simon Barber9-187/+142
The use of a flag field here is aesthetically unpleasing when the flags are referred to frequently. Convert these into bitfield entries. Change-Id: I6f47e31558439dfd343ec7f856d04480366a1237 Reviewed-on: https://code.wireshark.org/review/12511 Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-12-21Squelch another warning.Guy Harris1-1/+1
Change-Id: I7340954d9ca2fd11a6db2aa7cd5493d870181e23 Reviewed-on: https://code.wireshark.org/review/12765 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-12-21Squelch some compiler warnings.Guy Harris1-3/+3
Change-Id: Iee46c43498f42e19dfab0178e80743d35d843d2d Reviewed-on: https://code.wireshark.org/review/12762 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-12-21Rename some variables to make it a bit clearer what they are.Guy Harris1-31/+31
rec_length_remaining is the amount of data we haven't already read from the record; it starts out as the record length and gets decreased. It is not the length of data in the packet. Change-Id: I46cd78e29aee13a686f1f6c8efbe258277e15686 Reviewed-on: https://code.wireshark.org/review/12759 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-12-20Add bounds checks and fix a length argument.Guy Harris1-15/+34
Before reading the record header of a REC_FRAME{2,4,6} record, make sure the record length is >= the length of that header. Whe calling fix_pseudo_header(), pass the actual length of the packet data, not the remaining length of the record (which may include padding), so we don't read past the end of the packet data. Bug: 11827 Change-Id: I1c63a4cb014c4616ffdd202660e68c576f266872 Reviewed-on: https://code.wireshark.org/review/12756 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-12-19Add missing ERF types, mention another missing type, mention reserved space.Guy Harris2-0/+9
Add the TYPE_COLOR_HASH_POS and TYPE_COLOR_HASH_ETH types, note that type 26 has no #define, mention that types 28 through 31 are reserved for future record types. Change-Id: Ic828254599599c6bd7399d4682f9a3d4bff1f0f7 Reviewed-on: https://code.wireshark.org/review/12728 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-12-19ERF: Add basic no-break support for ERF_TYPE_META.Anthony Coddington2-5/+21
Update erf_open heuristic to not break when ERF_TYPE_META records are present. Remove check for maximum non-pad ERF type and add defines for reserved types. No dissection in this commit beyond record type name, this will come later. Change-Id: Ib64e450e26b2878b5519fb6afeafa2ce9477ac85 Reviewed-on: https://code.wireshark.org/review/12708 Petri-Dish: Anders Broman <a.broman58@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-12-18Removed local definitions of offsetof().Stig Bjørlykke1-4/+2
The offsetof() macro is an ANSI C library feature. Change-Id: I2ac91b0b4c94c6f6baf14133b076fdc5ed2e182b Reviewed-on: https://code.wireshark.org/review/12707 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>
2015-12-16Make zlib API constness-aware, take 2.Guy Harris2-5/+17
ZLIB_CONST must be defined before including zlib.h to expose z_const, *AND* z_const shouldn't be used unless it's defined, because older versions of zlib don't define it even if you define ZLIB_CONST. While we're at it, throw in some DIAG_OFF(cast-qual)/DIAG_ON(cast-qual) pairs to suppress unavoidable "cast throws away const qualification" warnings. The original "make zlib constness-aware" change also removed an unnecessary include of <zlib.h> from wiretap/wtap.c, so we do that as well. Change-Id: I3c5269a8fbc54bbbb4d316544cc7b8fa30614c19 Reviewed-on: https://code.wireshark.org/review/12675 Petri-Dish: Guy Harris <guy@alum.mit.edu> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-12-16Revert "Make zlib API constness-aware"Guy Harris2-3/+10
This reverts commit fb0246c6fd7cd34b820558f75eb48bba6326b768. That commit assumes that if you define Z_CONST, z_const will be defined; that is *not* the case with older versions of zlib, which don't define z_const under any circumstances. Change-Id: I6f9b7ea18922799b1aaf94dc2c63120128f2550a Reviewed-on: https://code.wireshark.org/review/12671 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-12-16Make zlib API constness-awareJoão Valverde2-10/+3
ZLIB_CONST must be defined before including zlib.h to expose 'z_const'. Change-Id: Ic0dbd59ed3c760dd84ef4546f6ff4d5d3db91519 Reviewed-on: https://code.wireshark.org/review/12547 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: Peter Wu <peter@lekensteyn.nl> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-12-06Get rid of a bunch of unused variables.Guy Harris3-9/+1
("Unused" includes "set but not used".) Change-Id: Id67859b366e8caa50262f8530630ec4e8ef1507a Reviewed-on: https://code.wireshark.org/review/12457 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-12-05Revert "Build Flex-generated files with "warnings are errors"."Guy Harris3-16/+29
This reverts commit b56f53884be3bab935058b2bbbb4da0b8bbbe7f6. Sadly, we *do* get warnings at this point with older versions of Flex, such as the one on the 32-bit OS X buildbot. Change-Id: I9aec1a16e9f2e1bbcfaac3dffdabdd89af5815e3 Reviewed-on: https://code.wireshark.org/review/12443 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-12-05Build Flex-generated files with "warnings are errors".Guy Harris3-29/+16
We shouldn't be getting warnings at this point. Change-Id: I363a48546cb8d916425f42962ae1697d52ed9a29 Reviewed-on: https://code.wireshark.org/review/12436 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>
2015-12-05Use noyywrap rather than defining our own yywrap functions.Guy Harris2-22/+10
Tweak lemonflex-tail.inc to fix an issue this reveals. It appears that, at least on the buildbots, the Visual Studio compiler no longer issues warnings for the code generated with %option noyywrap. Change-Id: Id64d56f1ae8a79d0336488a4a50518da1f511497 Reviewed-on: https://code.wireshark.org/review/12433 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-12-03[MP2T] Reading buffer should have MP2T_SIZE+TRAILER_LEN_MAX space to give ↵Michael Mann1-1/+1
room for non-zero trailer. Bug: 11820 Change-Id: I7e0a603c20ca0c524399beb3d89e14c45dc3a06e Reviewed-on: https://code.wireshark.org/review/12393 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>
2015-12-02Move the bitrate test against 0 to mp2t_bits_per_second().Guy Harris1-18/+26
As the comment says, that routine "[ensures] there is a valid bitrate", and a bitrate of 0, which comes from truncating a fractional bitrate, is not a valid bitrate (an MPEG-2 Transport Stream with a bitrate less than 1 bit per second is not going to carrry any sensible audio/video stream). Make the "first" argument unsigned; it can never be negative. Restructure the code and change some data types to make it more obvious that it can't. Change-Id: Idd4d073dc558bb31271318e14b2f74292cd16a2b Reviewed-on: https://code.wireshark.org/review/12352 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-12-01autotools: Fix g212f2f1João Valverde1-1/+1
Change-Id: If7185885faea2319fdce4d89a7a9bf40312bcfa6 Reviewed-on: https://code.wireshark.org/review/12346 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-12-01[MP2T] Prevent divide by zero.Michael Mann1-0/+5
Bug: 11821 Change-Id: I3243c837d84ccbce7d377810a5f381e906aeb1eb Reviewed-on: https://code.wireshark.org/review/12323 Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-12-01autotools: Clean abi-check with maintainer-cleanJoão Valverde1-1/+8
Change-Id: Ia2ce54592485d2995bcfd56bd127a2fedb1a7d07 Reviewed-on: https://code.wireshark.org/review/12293 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: Michael Mann <mmann78@netscape.net>
2015-11-30Handle Date: headers differently from other headers.Guy Harris1-43/+81
Handle Date: outside the "loop over magic strings" loop; that way, we don't have to compare against "Date:" twice. Don't use strlen() on constant strings - sizeof string - 1 lets us calculate the length at compile time. Change-Id: I7e4ff2f9762f96749a39609efa76430e5915d4f4 Reviewed-on: https://code.wireshark.org/review/12302 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-11-30Add some comments explaining what some code is doing.Guy Harris1-1/+26
Change-Id: Ib229fcf4d14fd3c01755f868789f430496c23ded Reviewed-on: https://code.wireshark.org/review/12300 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-11-30Treat invalid (negative or too-large) values in the packet header as errors.Guy Harris1-1/+61
Change-Id: I86564c485aacd3fcba3f3d8d9da492e0100155e8 Reviewed-on: https://code.wireshark.org/review/12299 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-11-30Fix out-of-bounds read in ascend_seek.Michael Mann1-0/+1
Bug: 11794 Change-Id: I74517806b119729ae6d9780bbd4bb094701ff05e Reviewed-on: https://code.wireshark.org/review/12266 Petri-Dish: Michael Mann <mmann78@netscape.net> Reviewed-by: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-11-29Add bounds checking to find_signature.Michael Mann1-2/+2
Bug: 11791 Change-Id: Ibaa2c16229c1b78818283ba5f954b09f3894dc60 Reviewed-on: https://code.wireshark.org/review/12270 Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-11-28Make the rate tables static and const.Guy Harris1-6/+6
No need to put them on the stack and initialize them at the beginning of the routine. Change-Id: Id6332be186660c881cf37290f70d03cc77ac66be Reviewed-on: https://code.wireshark.org/review/12265 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-11-28Make it more obvious why no bounds checks are necessary for 11n.Guy Harris1-6/+7
For unsigned x, x/8 is x >> 3, and x*8 is x << 3, so 8*(x/8) is the result of shifting x right 3 bits and then left 3 bits, which is the same as masking out the low-order 3 bits, and x - (8*x/8) is the result of subtracting all but the low-order 3 bits from x, thus it's the lower 3 bits, so you can just mask it with 0x7. That means the result is in the range 0 through 7, so as long as the array has 8 elements, you're OK; it does, but explicitly declare it as such, to make it clearer that it is, and to get compiler warnings if not all 8 elements are initialized. Change-Id: Iff9c0626b9bdc012cca52e4160dda9e947315bc4 Reviewed-on: https://code.wireshark.org/review/12264 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-11-28vwr: fix buffer overrun in getRatePeter Wu1-3/+6
Bug: 11789 Change-Id: Ieba9f32928b91be5d07b25bf54005155f7cc79f6 Reviewed-on: https://code.wireshark.org/review/12245 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-11-28Sanity check iSeries packet length to prevent heap-based buffer overflow.Michael Mann1-1/+1
Bug: 11798 Change-Id: I7aebe709ef4014a385819835ef6effabbb4f0ca4 Reviewed-on: https://code.wireshark.org/review/12238 Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-11-27wtap: Disable ISO C forbids conversion [-Wpedantic]João Valverde1-6/+4
wtap.c:74:25: warning: ISO C forbids conversion of object pointer to function pointer type [-Wpedantic] Choose ISO C or dynamic loading, can't have both. Change-Id: I6d48073dadaf7c1710bd87ed71a2e7b65970d47e Reviewed-on: https://code.wireshark.org/review/12165 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>
2015-11-27pcapng: Fix ISO C forbids conversion [-Wpedantic]João Valverde2-12/+19
pcapng.c:461:31: warning: ISO C forbids passing argument 3 of 'g_hash_table_insert' between function pointer and 'void *' [-Wpedantic] pcapng.c:1404:32: warning: ISO C forbids conversion of object pointer to function pointer type [-Wpedantic] pcapng.c:1918:32: warning: ISO C forbids conversion of object pointer to function pointer type [-Wpedantic] Change-Id: I535633098cc5d37442732dd92e8c9d3cda36631a Reviewed-on: https://code.wireshark.org/review/12161 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>
2015-11-26Scan pcapng change time to unsignedJoão Valverde1-1/+2
Fixes warning: nettrace_3gpp_32_423.c:813:4: warning: format '%u' expects argument of type 'unsigned int *', but argument 3 has type 'int *' [-Wformat=] Change-Id: I4bfcc19ecac115d5aa2e222dfed8ea8b0b450d71 Reviewed-on: https://code.wireshark.org/review/12211 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-11-26[mp2t] use the correct file infomation for PCR detectionMartin Kaiser1-7/+13
when we check for an mpeg2 transport stream, we're trying to detect an initial offset before the first sync byte and the length of additional data appended to each packet use those values when we go through the file again and verify the PCR Bug: 11749 Change-Id: Iab03cb271d23d38f850ca857b64ca47ba4501175 Reviewed-on: https://code.wireshark.org/review/12183 Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-11-26Process the radio information internally for AiroPeek classic files.Guy Harris3-41/+80
Process it in libwiretap; no need to hand it to libwireshark for dissection, it can just dissect the radio information pseudo-header with the processed information. Change-Id: I482697947eecbd3967cf1910ba2fa2bff805cd66 Reviewed-on: https://code.wireshark.org/review/12202 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-11-26Add a check for the day of the month.Guy Harris1-2/+18
Also, fix the month check ("month" is in the range 1 through 12, not 0 through 11), and if neither sscanf() gets the right number of fields, fail immediately. Change-Id: I3f0da49e969c020c292facb843b9741116647302 Reviewed-on: https://code.wireshark.org/review/12170 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-11-26Most fields in an ISO 8601 date/time are unsigned.Guy Harris1-3/+36
Add some bounds checks while we're at it. Change-Id: I19804aee10496fd68f95a27865f8f455d3abbe9f Reviewed-on: https://code.wireshark.org/review/12166 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-11-25Check whether create_tempfile() fails.Guy Harris1-0/+5
Thanks and a tip of the Hatlo hat to Coverity for finding this. Change-Id: Ie9d4089443e52ef427e0cc8ae6e90a9d9787134e Reviewed-on: https://code.wireshark.org/review/12123 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-11-23merge: fix parameter 'in_files/in_count_files' not found in the function ↵Alexis La Goutte1-6/+6
declaration [-Wdocumentation] Change-Id: Ib3d9b7df5f1396179645456ea7359e711c26b8ef Reviewed-on: https://code.wireshark.org/review/12003 Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-11-19use the official DLT for ISO14443Martin Kaiser3-0/+7
add DLT_ISO14443 to pcap_to_wtap_map[] define WTAP_ENCAP_ISO14443, link it to the iso14443 dissector Change-Id: Id837197c4d66071094f9336d60db36a371424807 Reviewed-on: https://code.wireshark.org/review/11959 Petri-Dish: Martin Kaiser <wireshark@kaiser.cx> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-11-17Misc minor issues caught by cppcheckEvan Huus3-4/+1
All trivial (unused variables, duplicate `break`s, etc). Change-Id: Idbfffae4f6c0b0119a90ae5849de2ed7a1180c9b Reviewed-on: https://code.wireshark.org/review/11886 Petri-Dish: Evan Huus <eapache@gmail.com> Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Evan Huus <eapache@gmail.com>
2015-11-16catapult: fix sscanf buffer overflowEvan Huus1-1/+1
Caught by cppcheck. The buffer is 9+1 characters, which means we should specify 9, not 10 to the scanf string since the count does not include the null-terminator. Change-Id: I0aae8cce337055b304efa9399cd5d8059928d2d8 Reviewed-on: https://code.wireshark.org/review/11887 Reviewed-by: Evan Huus <eapache@gmail.com>
2015-11-12Plug file descriptor leak.Guy Harris1-0/+1
Change-Id: I882cc5c264fdf97452c84bd5cea0e5d56bd6eb45 Reviewed-on: https://code.wireshark.org/review/11753 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-11-12Add wtap_dump_open_tempfile routines, to write to a temporary file.Guy Harris2-0/+88
It includes the temporary-file generation, so you don't have to do it yourself. Change-Id: I0798df95a5c5646224ec49612f50b423ed78547a Reviewed-on: https://code.wireshark.org/review/11751 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-11-11Put wtap_dump_open() right before wtap_dump_open_ng().Guy Harris1-7/+7
That matches what we do with the other two pairs of dump opening routines. Change-Id: I0e6e475573c3a8d4ab6cf991d0aadc14150af233 Reviewed-on: https://code.wireshark.org/review/11744 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-11-11Make routines used only within wiretap/merge.c static.Guy Harris2-114/+46
We just export some UI helpers and the Big Merge Engine. Change-Id: I60bc8ab167e7100189a9ce60d84c0e4db27b6bda Reviewed-on: https://code.wireshark.org/review/11689 Petri-Dish: Guy Harris <guy@alum.mit.edu> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-11-10Initial Sysdig syscall (event) support.Gerald Combs3-5/+130
Add a dissector for reading Sysdig event blocks. It only handles plain events but it's usable for reading trace files on hand here. Use a script to generate various parts of the dissector. As an experiment, update parts in-place instead of using a template. Ultimately there should probably be a top-level "Syscall" or "Event" dissector alongside the "Frame" dissector, which could then call this. You could then directly compare an executable's system calls alongside its network traffic. For now leverage the pcapng_block dissector and keep everything under "Frame". Next steps: - Items listed at the top of packet-sysdig-event.c. Change-Id: I17077e8d7f40d10a946d61189ebc077d81c4da37 Reviewed-on: https://code.wireshark.org/review/11103 Petri-Dish: Gerald Combs <gerald@wireshark.org> Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Gerald Combs <gerald@wireshark.org>
2015-11-10Fix typo.Guy Harris1-1/+1
Change-Id: I417de6124925dbfd9599ec7e90e287eb971457a3 Reviewed-on: https://code.wireshark.org/review/11687 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-11-10Call wtap_dump_open_check() in wtap_dump_init_dumper().Guy Harris1-15/+5
The callers of wtap_dump_init_dumper() always call wtap_dump_open_check() first, with the same arguments in all cases; pull the latter call into wtap_dump_init_dumper() itself. Change-Id: I2b44dc3a018745e175b5c74ff1a346749fec2b71 Reviewed-on: https://code.wireshark.org/review/11681 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-11-10Add a comment for is_stdout.Guy Harris1-1/+1
Change-Id: I88abb5a37a00ebc1a2a742ff36c8d6be75420dbe Reviewed-on: https://code.wireshark.org/review/11677 Reviewed-by: Guy Harris <guy@alum.mit.edu>