Commit Graph

366 Commits

Author SHA1 Message Date
Bill Meier b14bf98c06 Fix spelling: cant-->can't, wont-->won't, etc
Change-Id: I4497f1b8b6eab0e576d9dd31b732965f9a6679c6
Reviewed-on: https://code.wireshark.org/review/4124
Reviewed-by: Bill Meier <wmeier@newsguy.com>
2014-09-16 13:51:51 +00:00
Guy Harris 3031247cc3 Don't use the captured length as the packet length.
Add a routine ber_tvb_new_subset_length() used to construct tvbuffs for
parts of the packet, and have it check the specified length against the
*reported* length.  NOTE: that routine should really take an item and an
expert info value as arguments and, if the length is greater than the
remaining packet length, add an expert info for that.

Also, when counting items in a SEQUENCE-OF:

	keep track of whether we succeeded in counting them, and report
	an "unknown number of items" if we didn't;

	if the length of an item in the SEQUENCE-OF is so big we get an
	overflow, just bail out of the count loop and indicate that we
	didn't succeed in counting them - let the error be reported in
	the process of dissection.

Change-Id: I32172737baaed35fc9a0e6c19a727a6ac71ddfb2
Reviewed-on: https://code.wireshark.org/review/4103
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-09-14 00:22:23 +00:00
Guy Harris a2090cd205 Give more information about string encodings.
Fix some indentation while we're at it.

Change-Id: I887af6e7507e1cd3c7e2b5bb5124d913aea01f9c
Reviewed-on: https://code.wireshark.org/review/3552
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-08-11 09:41:02 +00:00
Michael Mann 188aa9a80e convert to proto_tree_add_subtree[_format]
Change-Id: Ib60ca75b7da8cfa21cfe2999c9b9448a02c332df
Reviewed-on: https://code.wireshark.org/review/2560
Tested-by: Michael Mann <mmann78@netscape.net>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2014-06-22 21:07:16 +00:00
Guy Harris ce3d2ff3de Rename dissector_add_handle() to dissector_add_for_decode_as().
Hopefully that name makes it clear what the routiner's purpose is, and
will encourage people to use it rather than using dissector_add_uint()
with a bogus integer value.

Change-Id: Ic5be456d0ad40b176aab01712ab7b13aed5de2a8
Reviewed-on: https://code.wireshark.org/review/2483
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-06-20 16:43:56 +00:00
Michael Mann 14824e6adf Revert "Fixup: tvb_* -> tvb_captured"
https://www.wireshark.org/lists/wireshark-dev/201406/msg00131.html

This reverts commit 246fe2ca4c.

Change-Id: Ib24bae0198c13a84bd7f731bf4af921212109a8f
Reviewed-on: https://code.wireshark.org/review/2430
Reviewed-by: Michael Mann <mmann78@netscape.net>
2014-06-19 18:25:59 +00:00
Dario Lombardo 246fe2ca4c Fixup: tvb_* -> tvb_captured
Change-Id: I9209c1271967405c34c1b6fa43e1726a4d3a5a3f
Reviewed-on: https://code.wireshark.org/review/2377
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-06-18 14:14:58 +00:00
Dario Lombardo 971ffd683e Fixup: tvb_get_string(z) -> tvb_get_string(z)_enc
Change-Id: I63a3704effe3fcab01a193dc39b6a22e9f1cf3fe
Reviewed-on: https://code.wireshark.org/review/2376
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-06-18 14:13:58 +00:00
Evan Huus 17a552666b fix underflow in BER constrained bitstrings
this can happen and cause invalid memory accesses with incorrectly-large padding
values

Bug:10187
Change-Id: Ib9b2a2fa10766efb4d95d588f57354a56373c626
Reviewed-on: https://code.wireshark.org/review/2325
Reviewed-by: Evan Huus <eapache@gmail.com>
2014-06-17 18:17:31 +00:00
Stig Bjørlykke 92fbff2483 Register BER dissector as new.
This makes it possible to dissect part of a package as ASN.1.

Change-Id: I53dd6bc916fa0d2c932d77fef437c2094fdd29ed
Reviewed-on: https://code.wireshark.org/review/2238
Reviewed-by: Evan Huus <eapache@gmail.com>
2014-06-16 06:50:00 +00:00
Michael Mann 73217d9f3f tvb_new_subset -> tvb_new_subset_length when length parameters are equal.
tvb_new_subset -> tvb_new_subset_remaining it appears that's what the intention is.

Change-Id: I2334bbf3f10475b3c22391392fc8b6864454de2d
Reviewed-on: https://code.wireshark.org/review/1999
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
2014-06-07 15:41:07 +00:00
Evan Huus ec5ba0795a Tweak ber_choice flow control.
There appear to be a couple of bugs in the flow control of this function (which
is very confusing), at least one of which is leading to a buffer overrun. See
the bug comments for more details and guesses of what the correct thing to do
is.

Bug:9579
Change-Id: Ibd3077792c7689a715ea53e8bf8c7a561c67389f
Reviewed-on: https://code.wireshark.org/review/1530
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Reviewed-by: Evan Huus <eapache@gmail.com>
2014-05-06 20:32:07 +00:00
Stig Bjørlykke 79b401b7f4 Remove all old BER functions.
This should complete the transition to the "New" type.

Change-Id: I882b088206c6e6d0592159451c943caeaf5b90ec
Reviewed-on: https://code.wireshark.org/review/1202
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-04-18 21:44:28 +00:00
Guy Harris 8c7fae2da2 Absolute and relative OIDs have different FT_ values.
This squelches some run-time dissector asserts.

Change-Id: I0ce33c4eb6e9c3bd371e47363a981e9a7a0dc789
Reviewed-on: https://code.wireshark.org/review/997
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-04-07 23:24:54 +00:00
Guy Harris 26f46d40e9 Handle string types with somewhat appropriate encodings.
For various string types defined in X.680, use the appropriate encoding,
or ENC_ASCII|ENC_NA in some cases where we don't have an appropriate
encoding yet.

This most significantly fixes the handling of BMPString and
UniversalString, which are supersets of ASCII (Unicode Basic
Multilingual Plane and Unicode, respectively), but don't encode ASCII
characters as single octets.  It also fixes UTF8String to, well,
properly recognize UTF-8.

This also lets us get rid of the special handling of SyntaxBMPString in
X.509sat (and, in fact, *requires* us to get rid of it, as, otherwise,
the string value appears twice).

Change-Id: I325c4e71a6110278eb23b86e0d986e6439cfc328
Reviewed-on: https://code.wireshark.org/review/994
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-04-07 22:46:30 +00:00
Alexis La Goutte 296591399f Remove all $Id$ from top of file
(Using sed : sed -i '/^ \* \$Id\$/,+1 d')

Fix manually some typo (in export_object_dicom.c and crc16-plain.c)

Change-Id: I4c1ae68d1c4afeace8cb195b53c715cf9e1227a8
Reviewed-on: https://code.wireshark.org/review/497
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-03-04 14:27:33 +00:00
Gilbert Ramirez 4cc694839d Fix all -fstrict-alias warnings found by gcc 4.1.2
The majority of the fixes are for calls to uat_new(). Instead of
having each caller cast its private data to (void**), we use void*
in the uat_new() API itself. Inside uat_new(), we cast the void*
to void**.

Some dissectors use val64_string arrays, so a VALS64() macro was
added for those, to avoid using VALS(), which is useful only for
value_string arrays.

packet-mq.c was changed because dissect_nt_sid() requires
a char**, not a guint**. All other callers of dissect_nt_sid() use
char*'s (and take the address of it) for their local storage. So,
this was changed to follow the other practices.

A confusion between gint and absolute_time_display_e in packet-time.c
was cleared up.

The ugliest fix is the addition of ip6_guint8_to_str(), for exactly
one caller. The caller uses one type of ip6 address byte array,
while ip6_to_str() expects another. This new function is in place
until the various address implementations can be consolidated.

Add VALS64() to the developer documentation.

Change-Id: If93ff5c6c8c7cc3c9510d7fb78fa9108e4552805
Reviewed-on: https://code.wireshark.org/review/48
Reviewed-by: Evan Huus <eapache@gmail.com>
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2014-02-03 09:26:10 +00:00
Evan Huus 2338fdea0f Add missing cast.
svn path=/trunk/; revision=54980
2014-01-27 13:12:59 +00:00
Stig Bjørlykke 3abb51aa67 Do not handle BER bitstring as ASCII string, because this will fail
when the first bit is set.

svn path=/trunk/; revision=54977
2014-01-27 09:57:24 +00:00
Jakub Zawadzki deb2b236f2 Add missing includes
svn path=/trunk/; revision=54332
2013-12-21 17:23:17 +00:00
Evan Huus a6415ece0a Rename a couple of to_str functions to have ep_ in the name. This makes it
obvious that the returned string is ephemeral, and opens up the original names
in the API for versions that take a wmem pool (and thus can work in any scope).

svn path=/trunk/; revision=54249
2013-12-19 15:49:09 +00:00
Gerald Combs 17a67c3b5c Get the "Decode As" dialog working, albeit with a few warts. It differs
from the GTK flavor in two major ways:

- The "Decode As" and "User Specified Decodes" dialog have been unified.
- You can modify the decode as behavior at any time, not just when you
  have a packet selected.

Revert part of 53498 so that we can move items marked

/*** THE FOLLOWING SHOULD NOT BE USED BY ANY DISSECTORS!!! ***/

from epan/decode_as.h to ui/decode_as_utils.h. 

Move "save" code from decode_as_dlg.c to decode_as_utils.c as well.

In packet-dcerpc.c don't register a table named "ethertype". We might
want to add checks for duplicate table names.

To do:
- Add support for ranges?
- Either add support for DCERPC or make DCERPC use a regular dissector
  table.
- Fix string selectors (i.e. BER).


svn path=/trunk/; revision=53910
2013-12-10 19:23:26 +00:00
Anders Broman 304eba4d95 Mark parameter as unused
packet-ber.c:391: warning: unused parameter 'table_name'

svn path=/trunk/; revision=53447
2013-11-20 19:52:21 +00:00
Michael Mann 76ab93ea94 Provide "Decode As" functionality through dissectors themselves instead of the GUI. Bug 9450 (https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9450)
The basic idea behind this design is to have dissectors register with a "decode as list" with their name and dissector table.  When "Decode As" dialog is launched, any "registered" dissector found in the packet will cause a tab to be created in the dialog.

This patch includes just the dissector portion of the functionality (minus packet-dcerpc.[ch] because it has hooks to the current GUI)

svn path=/trunk/; revision=53445
2013-11-20 19:17:08 +00:00
Jakub Zawadzki ae59b09443 Add missing includes in order to remove exceptions.h from proto.h (next commit).
svn path=/trunk/; revision=53230
2013-11-10 15:59:37 +00:00
Michael Mann 02a8391535 Require dissector_try_string to pass a data parameter to its subdissectors. There weren't that many calls, so might as well modify the function than create a need for dissector_try_string_new.
svn path=/trunk/; revision=53049
2013-11-02 15:52:25 +00:00
Michael Mann c0fcebb07a Add a data parameter to call_ber_oid_callback to be able to pass data to subdissectors found with dissector_try_string_new.
The intention is to aid in the removal of pinfo->private_data use as well as static global variables in a dissector.  For now, all calls to call_ber_oid_callback have the data parameter set to NULL.

svn path=/trunk/; revision=52994
2013-10-31 00:57:03 +00:00
Bill Meier 9874da2fcb #if 0 numerous "unused const variables" (mostly value-string-arrays);
Also; fix a few "set but not used" warnings.

svn path=/trunk/; revision=52780
2013-10-23 06:29:11 +00:00
Bill Meier 2ac134b3c5 whitespace fixes; mostly: remove trailing blanks
svn path=/trunk/; revision=52591
2013-10-13 19:56:52 +00:00
Pascal Quantin 16333c062d From Ed Beroset via https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9192 :
Cleanup of relative and absolute OID decoding in packet-ber.c

svn path=/trunk/; revision=52420
2013-10-06 20:59:05 +00:00
Michael Mann ee208c8dcc Add support for RELATIVE-OID ASN.1 type. Bug 9192 (https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9192)
From Ed Beroset.

svn path=/trunk/; revision=52393
2013-10-06 02:31:10 +00:00
Michael Mann cf80442912 Convert some proto_tree_add_string_format calls to something more appropriate.
There seem to be several cases of proto_tree_add_string_format where a "string" value/filter doesn't really make sense because it's always empty, and is just being used as a "filterable subtree header (placeholder)".  They appear to be more for "presense" than "value" and should probably be FT_NONE, although I'd almost argue for removing the filter in favor of  proto_tree_add_text.

svn path=/trunk/; revision=52296
2013-09-30 15:21:09 +00:00
Pascal Quantin a0c53ffaa1 emem -> wmem conversion:
- ep_tvb_get_bits() -> wmem_packet_tvb_get_bits()
- tvb_g_memdup()/ep_tvb_memdup() -> tvb_memdup()
- tvb_fake_unicode()/tvb_get_ephemeral_faked_unicode() -> tvb_get_faked_unicode()
- tvb_get_g_string()/tvb_get_ephemeral_string()/tvb_get_seasonal_string() -> tvb_get_string()
- tvb_get_g_unicode_string()/tvb_get_ephemeral_unicode_string() -> tvb_get_unicode_string()
- tvb_get_ephemeral_string_enc() -> tvb_get_string_enc()
- update docs accordingly

svn path=/trunk/; revision=52172
2013-09-22 15:50:55 +00:00
Anders Broman f3e76b0953 Indicate Sequence of 0 length.
svn path=/trunk/; revision=52155
2013-09-20 14:20:06 +00:00
Pascal Quantin 6cedc2c336 Convert a few more dissectors to wmem
svn path=/trunk/; revision=51991
2013-09-12 22:03:31 +00:00
Michael Mann 9e3f9b449f expert_add_info_format_text -> expert_add_info_format
svn path=/trunk/; revision=51852
2013-09-09 00:44:09 +00:00
Jakub Zawadzki f4bcbeb9f2 Keep result of [new_]register_dissector in some dissectors. [2 of x]
(don't create new dissector handle if we can use already existing one)

svn path=/trunk/; revision=51159
2013-08-05 19:09:44 +00:00
Jakub Zawadzki a18172147f Remove fragment_data, add fragment_head, fragment_item - for now alias it to the same structure.
This is begin of work to split fragment head and fragments items.

svn path=/trunk/; revision=50708
2013-07-17 21:12:24 +00:00
Jakub Zawadzki c766e78cfa Rewrite reassemble API to use TVBs instead of raw data.
(it seems to be working for TCP ^^)

svn path=/trunk/; revision=50580
2013-07-14 14:42:05 +00:00
Michael Mann a6acb73611 Make expert items filterable. First use of proto_tree_add_expert.
svn path=/trunk/; revision=50327
2013-07-02 21:16:10 +00:00
Pascal Quantin de10bc6b5e Fix https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8799 :
Display certificate as UINT64 and add support for a 64bits unsigned value in BER dissector

svn path=/trunk/; revision=50096
2013-06-20 23:37:16 +00:00
Jeff Morriss a7bb5e1835 Rework the change from r15595 a bit: when creating a TVB subset, always give
the same captured and reported lengths so that we don't end up throwing
BoundsErrors ("Packet size limited during capture") when the packet is simply
malformed.

This fixes one of the issues reported in https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8816

svn path=/trunk/; revision=50055
2013-06-19 19:31:40 +00:00
Evan Huus 0844929247 Follow-up to r49055 as noted on
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=7359

The BER integer dissection routines take an hf_id, but that can be -1.
Only fetch the type (to check signedness) if hf_id >= 0, as otherwise this
causes a dissector bug. Default to signed if given no hf_id - I don't know
whether this should be unsigned or not, but the old behaviour was that
everything was signed so it's not a regression at least.

svn path=/trunk/; revision=49101
2013-04-30 23:19:47 +00:00
Evan Huus 5b8a3df249 From me: only sign-extend BER integers if the field is actually signed
From Guy: override two fields in the GOOSE ASN.1 dissector to be unsigned

Together these fix
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8250


svn path=/trunk/; revision=49055
2013-04-26 19:23:36 +00:00
Evan Huus cb387ad2de Initialize branch_taken right at the top of dissect_ber_choice so that the
caller can depend on it being initialized even in peculiar error conditions.

Fixes the other half of https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8599

svn path=/trunk/; revision=48944
2013-04-20 21:20:00 +00:00
Guy Harris a2414d8909 Don't wire into the reassembly code the notion that reassemblies should
be done on flows from one address to another; reassembly for protocols
running atop TCP should be done on flows from one TCP endpoint to
another.

We do this by:

	adding "reassembly table" as a data structure;

	associating hash tables for both in-progress reassemblies and
	completed reassemblies with that data structure (currently, not
	all reassemblies use the latter; they might keep completed
	reassemblies in the first table);

	having functions to create and destroy keys in that table;

	offering standard routines for doing address-based and
	address-and-port-based flow processing, so that dissectors not
	needing their own specialized flow processing can just use them.

This fixes some mis-reassemblies of NIS YPSERV YPALL responses (where
the second YPALL response is processed as if it were a continuation of
a previous response between different endpoints, even though said
response is already reassembled), and also allows the DCE RPC-specific
stuff to be moved out of epan/reassembly.c into the DCE RPC dissector.

svn path=/trunk/; revision=48491
2013-03-22 23:59:54 +00:00
Anders Broman 81e80f2c0b From beroset:
remove C++ incompatibilities 
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8416

svn path=/trunk/; revision=48355
2013-03-17 16:48:47 +00:00
Anders Broman 54eb4a6cec [-Wmissing-prototypes]
Use explicit casts.

svn path=/trunk/; revision=48319
2013-03-15 16:39:30 +00:00
Bill Meier 96a24cc79f Fix spelling/typos found using a list of commonly misspelled words.
The misspellings were mostly in comments but some were
in text strings visible to the user.


svn path=/trunk/; revision=47899
2013-02-26 04:42:26 +00:00
Bill Meier 1823aa007c it's ==> its & its ==> it's as needed.
svn path=/trunk/; revision=47891
2013-02-26 01:06:19 +00:00