Commit Graph

443 Commits

Author SHA1 Message Date
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
Guy Harris e2b61c828f Constify some character pointer variables to avoid warnings about
strings being assigned to them.

svn path=/trunk/; revision=46653
2012-12-21 05:34:38 +00:00
Bill Meier f498c3a172 Reformat for readability:
indentation, whitespace, long-lines, etc.
Also;
- replace two usages of fprintf(stderr,...) by g_warning();
- revert incorrect replacement of FALSE by ENC_BIG_ENDIAN
  done a while back (2 cases);
  [The incorrect use of ENC_BIG_ENDIAN was benign since
   ENC_BIG_ENDIAN is currently defined ad 0x0000000]

svn path=/trunk/; revision=45625
2012-10-18 02:33:11 +00:00
Jeff Morriss 2552c750e5 We always HAVE_CONFIG_H so don't bother checking whether we have it or not.
svn path=/trunk/; revision=45017
2012-09-20 02:03:38 +00:00
Jeff Morriss aa5d9d78dd From Robert Bullen via https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=7683 :
The reassembled fragments tree in the Packet Details view is awesome, but it
lacks one thing: a field that exposes the reassembled data.

tcp.data already exists for exposing a single TCP segment's payload as a byte
array. It would be handy to have something similar for a single application
layer PDU when TCP segment reassembly is involved. I propose
tcp.reassembled.data, named and placed after the already existing field
tcp.reassembled.length.

My primary use case for this feature is outputting tcp.reassembled.data with
tshark for further processing with a script.

The attached patch implements this very feature. Because the reassembled
fragment tree code is general purpose, i.e. not specific to just TCP, any
dissector that relies upon it can add a similar field very cheaply. In that
vein I've also implemented ip.reassembled.data and ipv6.reassembled.data, which
expose reassembled fragment data as a single byte stream for IPv4 and IPv6,
respectively. All other protocols that use the reassembly code have been left
alone, other than inserting NULL into their initializer lists for the newly
introduced struct field reassemble.h:fragment_items.hf_reassembled_data.

svn path=/trunk/; revision=44802
2012-09-07 02:09:59 +00:00
Michael Mann 5dd7371960 more ephemeral memory cleanup
svn path=/trunk/; revision=44496
2012-08-14 17:58:41 +00:00
Bill Meier 638d74d43f Use val_to_str_const() where appropriate;
Also (for a few files):
- create/use some extended value strings;
- remove unneeded #include files;
- remove unneeded variable initialization;
- re-order fcns slightly so prefs_reg_handoff...() at end, etc

svn path=/trunk/; revision=44438
2012-08-10 22:55:02 +00:00
Guy Harris 659cf0527a UATs could be put into "categories". The categories were defined only
implicitly by the #define name and string they were defined to; not all
UATs neatly fit into any of the categories, so some of them were put
into categories that weren't obviously correct for them, and one - the
display filter macro UAT - wasn't put into any category at all (which
caused crashes when editing them, as the GUI code that handled UAT
changes from a dialog assumed the category field was non-null).

The category was, in practice, used only to decide, in the
aforementioned GUI code, whether the packet summary pane needed to be
updated or not.  It also offered no option of "don't update the packet
summary pane *and* don't redissect anything", which is what would be
appropriate for the display filter macro UAT.

Replace the category with a set of fields indicating what the UAT
affects; we currently offer "dissection", which applies to most UATs
(any UAT in libwireshark presumably affects dissection at a minimum) and
"the set of named fields that exist".  Changing any UAT that affects
dissection requires a redissection; changing any UAT that affects the
set of named fields that exist requires a redissection *and* rebuilding
the packet summary pane.

Perhaps we also need "filtering", so that if you change a display filter
macro, we re-filter, in case the display is currently filtered with a
display filter that uses a macro that changed.

svn path=/trunk/; revision=43603
2012-07-08 01:00:46 +00:00
Jakub Zawadzki bf81b42e1e Update Free Software Foundation address.
(COPYING will be updated in next commit)

svn path=/trunk/; revision=43536
2012-06-28 22:56:06 +00:00
Anders Broman cec562ddd2 From Alex Lindberg: Add preference to packet-ber.c to toggle BER warning on leading zero bits. https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=7328
svn path=/trunk/; revision=43098
2012-06-05 05:16:06 +00:00
pascal 8f557d0874 Attempt to fix clang warnings (dead assignment, dereference of null pointer, branch condition evaluates to a garbage value)
svn path=/trunk/; revision=42392
2012-05-02 21:55:59 +00:00
Bill Meier 159901cd15 Use consistent indentation;
Use #if 0/#endif to comment out some code (rather than /* ... */

svn path=/trunk/; revision=42212
2012-04-23 17:43:56 +00:00
Jakub Zawadzki 8a1dc57c03 Remove doubled semicolons and semicolons outside function.
svn path=/trunk/; revision=42053
2012-04-13 20:22:31 +00:00
Jeff Morriss 5adc2792e4 Fix CID 620: since we're checking if the given hf index is positive (since
r15662), move the proto_tree_add_boolean() call (which uses the hf index)
inside the check.

svn path=/trunk/; revision=41910
2012-04-03 17:37:27 +00:00
Anders Broman cd6d0b075f Use hfi->abbrev insted.
svn path=/trunk/; revision=40376
2012-01-04 19:06:34 +00:00
Anders Broman 906d2aecbb Enhance error information.
svn path=/trunk/; revision=40361
2012-01-03 22:06:42 +00:00
Anders Broman 4a00a8ac58 Squelsh warnings.
svn path=/trunk/; revision=40025
2011-11-28 16:42:43 +00:00
Jaap Keuter f14c2c772b Move some comments around to make it more boilerplate like.
svn path=/trunk/; revision=39992
2011-11-22 21:51:24 +00:00
Anders Broman b431591727 Get rod of " warning: identifier ‘class’ conflicts with C++ keyword"
svn path=/trunk/; revision=39945
2011-11-19 09:08:50 +00:00
Stig Bjørlykke 89880b5b59 Increase the size of a unknown INTEGER to FT_INT64 to be able to show
negative integers and integers up to MAXINT64.  We still don't support
integers between MAXINT64 and MAXUINT64, which would be 9 bytes long.

svn path=/trunk/; revision=39673
2011-10-30 15:55:18 +00:00
Bill Meier 293049dfba Do some conversions of proto_tree_add_item() 'encoding' arg.
(previously missed).

    57   FT_BOOLEAN:       FALSE-->ENC_BIG_ENDIAN
    31   FT_BOOLEAN:       TRUE-->ENC_LITTLE_ENDIAN

    10   FT_BYTES:         ENC_BIG_ENDIAN-->ENC_NA
     1   FT_BYTES:         ENC_LITTLE_ENDIAN-->ENC_NA
    21   FT_BYTES:         FALSE-->ENC_NA
     2   FT_BYTES:         TRUE-->ENC_NA

     2   FT_IPXNET:        ENC_BIG_ENDIAN-->ENC_NA

     6   FT_IPv6:          ENC_BIG_ENDIAN-->ENC_NA
     1   FT_IPv6:          FALSE-->ENC_NA

     6   FT_NONE:          ENC_BIG_ENDIAN-->ENC_NA
    19   FT_NONE:          FALSE-->ENC_NA
     3   FT_NONE:          TRUE-->ENC_NA

     1   FT_STRING:        ENC_BIG_ENDIAN-->ENC_ASCII|ENC_NA
     1   FT_STRING:        ENC_LITTLE_ENDIAN-->ENC_ASCII|ENC_NA
     5   FT_STRING:        FALSE-->ENC_ASCII|ENC_NA
     1   FT_STRING:        TRUE-->ENC_ASCII|ENC_NA

     4   FT_STRINGZ:       ENC_NA-->ENC_ASCII|ENC_NA
     8   FT_STRINGZ:       FALSE-->ENC_ASCII|ENC_NA

     1   FT_INT32:         FALSE-->ENC_BIG_ENDIAN
     1   FT_INT32:         TRUE-->ENC_LITTLE_ENDIAN

    11   FT_UINT8:         0-->ENC_BIG_ENDIAN
   111   FT_UINT8:         FALSE-->ENC_BIG_ENDIAN
    17   FT_UINT8:         TRUE-->ENC_LITTLE_ENDIAN
     1   FT_UINT16:        0-->ENC_BIG_ENDIAN
    68   FT_UINT16:        FALSE-->ENC_BIG_ENDIAN
    18   FT_UINT16:        TRUE-->ENC_LITTLE_ENDIAN
     4   FT_UINT24:        FALSE-->ENC_BIG_ENDIAN
    70   FT_UINT32:        FALSE-->ENC_BIG_ENDIAN
     1   FT_UINT32:        TRUE-->ENC_LITTLE_ENDIAN
     4   FT_UINT64:        FALSE-->ENC_BIG_ENDIAN
     1   FT_UINT64:        TRUE-->ENC_LITTLE_ENDIAN

     1   FT_UINT_STRING:   FALSE-->ENC_ASCII|ENC_BIG_ENDIAN


svn path=/trunk/; revision=39442
2011-10-16 23:38:49 +00:00
Anders Broman 4b952c1324 Get rid of check_col, while at it set ENC.
svn path=/trunk/; revision=39146
2011-09-26 08:25:18 +00:00
Stig Bjørlykke 7f4e941ab6 Add an expert info warning for integers encoded with too many octets.
svn path=/trunk/; revision=38771
2011-08-29 10:01:36 +00:00
Graeme Lunt a8d3a3ea8c Allow the dissection of BER/DER carried over a TCP transport using
"Decode As..."


svn path=/trunk/; revision=38560
2011-08-16 12:28:17 +00:00
Bill Meier a2b58f051d Add #include <stdlib.h> to files which reference fcns declared in stdlib.h;
(In many cases I previously incorrectly removed the #include <stdlib.h>).

svn path=/trunk/; revision=37334
2011-05-20 19:00:09 +00:00
Anders Broman f62ac53352 From Yaniv Kaul:
Fix 'set but not used' errors that GCC 4.6 emits.

svn path=/trunk/; revision=36892
2011-04-27 05:24:31 +00:00
Stig Bjørlykke 1fd17eb0d9 Fixed blurb for BER Error.
svn path=/trunk/; revision=36495
2011-04-06 09:59:21 +00:00
Stig Bjørlykke 3a1673c04c Made "BER Error" filterable.
svn path=/trunk/; revision=36494
2011-04-06 08:52:42 +00:00
Ronnie Sahlberg 13f6b77d92 remove two pointless const in casts
coverity 580 and 581

svn path=/trunk/; revision=36407
2011-03-30 04:36:09 +00:00
Tomas Kukosa 0b9c645150 Fix warning
svn path=/trunk/; revision=36139
2011-03-04 14:36:27 +00:00
Tomas Kukosa 3f8b9e87a9 Check only first 14 digits of GeneralizedTime which are fixed, next parts are optional
svn path=/trunk/; revision=36138
2011-03-04 14:01:57 +00:00
Gerald Combs dae5200002 Fix some Visual C++ analysis warnings.
svn path=/trunk/; revision=35988
2011-02-17 23:00:34 +00:00
Stig Bjørlykke 0ac8e7cc8d Put error messages and expert info for illegal UTCTime elements as a
subtree on the UTCTime element.

svn path=/trunk/; revision=35945
2011-02-14 10:18:03 +00:00
Stig Bjørlykke 84bc28bd6a Introduce "Fragment count" filter element for all protocols doing reassembly.
svn path=/trunk/; revision=35705
2011-01-30 21:01:07 +00:00
Jeff Morriss e80012653f Fix https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=5537 :
Don't go modifying the bitstring if its length is 0 (meaning that there is only
the NULL terminator).

svn path=/trunk/; revision=35342
2011-01-03 17:37:41 +00:00
Guy Harris d049046268 Note that this is ultimately not necessarily the right fix.
svn path=/trunk/; revision=35331
2011-01-02 21:49:00 +00:00
Guy Harris 8d7d050e9e For those cases where we interpret the contents of an OCTET STRING,
which could be of arbitrary length - even if it's not supposed to be! -
as a value of some other type, by adding them as a registered field,
first check to make sure the length of the field is appropriate for the
type and, if not, show a dissection error, rather than showing a
dissector-bug assertion when we call proto_tree_add_item().

This fixes a bunch of dissector-bug assertions that show up with
malformed BER-encoded packets.

Also, fix a typo, and expand a comment.

svn path=/trunk/; revision=35330
2011-01-02 21:27:57 +00:00
Guy Harris a8bc4a0d13 Rename the routines that handle dissector tables with unsigned integer
keys to have _uint in their names, to match the routines that handle
dissector tables with string keys.  (Using _port can confuse people into
thinking they're intended solely for use with TCP/UDP/etc. ports when,
in fact, they work better for things such as Ethernet types, where the
binding of particular values to particular protocols are a lot
stronger.)

svn path=/trunk/; revision=35224
2010-12-20 05:35:29 +00:00
Anders Broman bb0eefd834 Fix a cut-n-paste error.
svn path=/trunk/; revision=34866
2010-11-14 14:13:52 +00:00
Anders Broman 2c042dcd15 Use value_string_ext.
svn path=/trunk/; revision=34845
2010-11-11 21:18:15 +00:00
Stig Bjørlykke 34d9ef736b Added an expert info for illegal integer length.
svn path=/trunk/; revision=34820
2010-11-09 12:17:11 +00:00
Stig Bjørlykke c56ac0d6db Removed calls to proto_item_set_expert_flags(), as this will be called
in expert_add_info_format().

svn path=/trunk/; revision=34819
2010-11-09 12:15:55 +00:00
Jeff Morriss e17b9ccec1 Rev 29427 added packet_add_new_data_source() with a comment indicating that
the data source does not need to be allocated if (!tree).

Rev 30158 took the if (!tree) check out indicating that the check was invalid.

So: (since packet_add_new_data_source() now only calls add_new_data_source()),
remove packet_add_new_data_source().

svn path=/trunk/; revision=34717
2010-10-30 16:00:30 +00:00
Guy Harris 17d4d51b7d Make the third argument to a UAT copy callback a size_t (not that any of
the callbacks we have use that argument - is it really needed?).

svn path=/trunk/; revision=34694
2010-10-29 21:11:33 +00:00
Martin Mathieson 9d87437659 Add volatile in several places to gcc warnings.
svn path=/trunk/; revision=34526
2010-10-15 18:41:12 +00:00
Stig Bjørlykke 2b34ed288b Avoid getting BoundsError when trying to decode OCTET STRING or
unknown primitive as constructed ASN.1 BER encoded data.

svn path=/trunk/; revision=34520
2010-10-15 11:10:20 +00:00
Stig Bjørlykke 7c3f2513ee Remove unneeded includes.
svn path=/trunk/; revision=34289
2010-09-30 19:20:59 +00:00
Stig Bjørlykke 65e0721f71 Constructed octet strings may contain zero encodings.
(X.690 chapter 8.7.3)

svn path=/trunk/; revision=34284
2010-09-30 06:19:32 +00:00
Gerald Combs 4c74418400 Attempt to fix the stack overflow reported at
http://seclists.org/bugtraq/2010/Sep/87 .

Unfortunately no one from the NCNIPC pen test team has contacted us or
provided a sample capture so the fix hasn't been verified.

svn path=/trunk/; revision=34111
2010-09-13 18:49:55 +00:00
Stig Bjørlykke 16db2dd4f5 Check if using tree before adding the octet string.
svn path=/trunk/; revision=34055
2010-09-03 08:44:00 +00:00
Stig Bjørlykke 598b89ab7f Added a check for constructed octet string to avoid a loop.
This fixes bug 5154.

svn path=/trunk/; revision=33949
2010-08-27 11:55:14 +00:00
Stig Bjørlykke 8b6c6a3dbf Display constructed octet strings with correct hf_id.
Show octet string fragments as for reassembly.

svn path=/trunk/; revision=33910
2010-08-24 15:08:07 +00:00
Gerald Combs 3a5ba15b4d Rename a variable. "tmp_len" was too similar to "tmp_length".
svn path=/trunk/; revision=33506
2010-07-13 22:49:17 +00:00
Gerald Combs 041cd31c9e Revert get_ber_length() back to r32530, which removes all of the changes
back to and including my attempt to make it iterative. Move its guts
back into try_get_ber_length() and add a recursion level check.

This should fix CVE-2010-2284 and preserve existing behavior without
introducing any new regressions (such as bug 5000).

svn path=/trunk/; revision=33505
2010-07-13 22:41:34 +00:00
Gerald Combs cfe9b05691 Add length checks.
svn path=/trunk/; revision=33488
2010-07-12 17:30:14 +00:00
Gerald Combs edb7f000dc Assume that if we have more than 500 levels of nested indefinite lengths
we have a malformed packet.

svn path=/trunk/; revision=33480
2010-07-09 17:07:34 +00:00
Jeff Morriss 4e76ef92cb For: https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=4984#c4 : In try_get_ber_length() don't let a negative length make us go backwards. This should eliminate a possible infinite loop and appears to /help/ limit the depth of recursion.
svn path=/trunk/; revision=33471
2010-07-07 22:00:44 +00:00
Jeff Morriss c24f16ad44 Fix infinite recursion reported in https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=4984 : In try_get_ber_length() make sure we move forward before recursing.
svn path=/trunk/; revision=33464
2010-07-07 15:52:09 +00:00
Gerald Combs a7df969fb1 Have get_ber_length() set the length to 0 by default. This restores behavior
that was lost recently.

svn path=/trunk/; revision=33402
2010-07-01 16:35:37 +00:00
Graeme Lunt 852d60ca7e When determining a BER length, make sure the BER identifier was marked as constructed if an indefinite length is encountered.
This helps prevent a stack overflow problem reported in Bug 4951.


svn path=/trunk/; revision=33383
2010-06-30 10:06:21 +00:00
Stig Bjørlykke e777398d4f Added expert info for illegal bitstring padding and when bits are set
in the padded area.

svn path=/trunk/; revision=33382
2010-06-30 09:09:18 +00:00
Bill Meier 9427f9f2c3 Hack to prevent checkAPIs.pl from complaining about missing const in
'static value_string syntax_names[...]' 

svn path=/trunk/; revision=33365
2010-06-29 03:43:17 +00:00
Gerald Combs a9650cd851 Don't try to use a NULL tvb in call_ber_oid_callback(). Fixes bug 4950.
svn path=/trunk/; revision=33363
2010-06-29 00:44:41 +00:00
Gerald Combs a514fe61c3 tvb_get_ptr() may not return a valid string. Must I break out the
picture of the cow again?

svn path=/trunk/; revision=33361
2010-06-28 23:11:48 +00:00
Gerald Combs dd4e194304 Make sure dissect_ber_integer() always sets a value.
svn path=/trunk/; revision=33358
2010-06-28 22:13:53 +00:00
Stig Bjørlykke 1c81c60477 Search in user defined oid syntax table before built-in oid table in
call_ber_oid_callback(), so the user can override the defaults in the
"OID Tables".

svn path=/trunk/; revision=33355
2010-06-28 19:06:16 +00:00
Gerald Combs e2c79ddfd0 It looks like dissect_ber_octet_string() is called with the expectation
that out_tvb will always be set (the H.248 dissector does this, at
least). Make sure we do so. Do the same for
dissect_ber_constrained_octet_string().

svn path=/trunk/; revision=33354
2010-06-28 17:26:07 +00:00
Graeme Lunt 342fc4cfb4 After a nudge from Stig (thanks Stig), convert the OID configuration from
GKeyFile (which is not available on Sparc Solaris) to a User Accessible 
Table(UAT). 
This also allows the user to manage the configuration from the Wireshark GUI 
and select the associated syntax from a drop down list.


svn path=/trunk/; revision=33344
2010-06-28 09:33:04 +00:00
Graeme Lunt 14d5a86ee5 The version of glib on Solaris 10 (2.4?) does not support GKeyFile which was
introduced in 2.6. Disable oid table if GKeyFile is not available. 


svn path=/trunk/; revision=33303
2010-06-23 14:26:19 +00:00
Graeme Lunt 1fce0a0ac2 Configuration to allow the definition of an OID name and associated syntax.
It allows the user to:
* Add names and/or syntaxes for OIDs that Wireshark doesn't natively understand
* Override the built-in OID names (e.g. change 'id-at-organization' to 'o')
* Use a special syntax, "ASN.1", that allows a value associated with an OID 
  to be dissected as "unknown ber". (This is a effectively a selective 
  version of the "Decode unexpected tags as BER encoded data" BER option.)

The configuration file is a glib key-value file, with the dotted OID used as
the group, and two keys defined, "name" and "syntax".

A configuration option is added to the BER preferences page. A single 
configuration file may be specified, or a directory may be specified. If a 
directory is specified, then the files with a ".oid" extension will be loaded.

An example configuration file:

[2.5.21.5]
name=attributeTypes
syntax=ASN.1
[2.5.21.6]
name=objectClasses
[2.5.21.7]
name=nameForms
[1.2.840.10040.4.3]
name=id-dsa-with-sha1
[2.5.4.6]
name=c
[2.5.4.10]
name=o
[2.5.4.11]
name=ou
[2.5.4.3]
name=cn
[1.3.32.0.2.0.4.66]
name=Unknown OID
syntax=PrintableString
[0.9.2342.19200300.100.1.10]
name=unknown dn
syntax=DistinguishedName

----

The list of known syntaxes is shown in the "Decode As ..." dialog when 
examining a BER file.


svn path=/trunk/; revision=33300
2010-06-23 11:28:59 +00:00
Graeme Lunt eef8c02bd7 Bug 3597 - implicit octet string that is constructed causes PRES/FTAM dissect failure
Introduced some state to remember last dissected Tag/Length so that they can be recalled if an IMPLICIT tag is encountered and stripped. This allows its to be determined if the value has a constructed value - and so can be reassembled.

In this case, it is a IMPLICIT constructed OCTET STRING at the presentation layer.

Many thanks to Fred Gruman for identifying - and apologies for the delay in commiting.


svn path=/trunk/; revision=33048
2010-06-02 14:42:57 +00:00
Graeme Lunt 3644d0faa7 Updated get_ber_length to handle multiple nested indefinite length encodings.
svn path=/trunk/; revision=33046
2010-06-02 13:33:37 +00:00
Gerald Combs 20914ee220 Make get_ber_length() iterative instead of recursive so we don't overrun the
stack. Discovered by J. Oquendo.

svn path=/trunk/; revision=32922
2010-05-23 23:42:58 +00:00
Stig Bjørlykke dc4ecbf172 Do not give a warning for not implemented OID if value is a "NULL tag".
svn path=/trunk/; revision=32530
2010-04-21 10:05:19 +00:00
Stig Bjørlykke 8f5c4683ea Added an option to try decoding unknown primitives as BER encoded data.
svn path=/trunk/; revision=31740
2010-01-30 17:44:45 +00:00
Stig Bjørlykke 9b2f05da33 Don't try decode an empty octetstring as BER.
svn path=/trunk/; revision=31589
2010-01-20 12:47:26 +00:00
Stig Bjørlykke 174de72350 Moved expert info for bitstring size constraints below bit values.
Enabled bitstring minimum length size check.

svn path=/trunk/; revision=31564
2010-01-19 08:54:13 +00:00
Stig Bjørlykke 6ff81c8f6a Change group for "Unknown bit(s)" expert info to Undecoded.
svn path=/trunk/; revision=31563
2010-01-19 08:11:23 +00:00
Stig Bjørlykke 10466c4bbe Add expert info to unknown bitstring bits when having a named_bits table.
svn path=/trunk/; revision=31554
2010-01-18 20:08:56 +00:00
Anders Broman c4dd31cd87 From Didier Gautheron:
col_clear.diff 
Remove calls to col_clear :
- called twice.
- before functions which also clear the column
- by replacing col_clear + col_append_xxx with col_add_xxx
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=4394

svn path=/trunk/; revision=31517
2010-01-13 20:25:10 +00:00
Stig Bjørlykke 6a433058f9 Added check for SIZE constraints in bit-string.
svn path=/trunk/; revision=31447
2010-01-05 11:38:33 +00:00
Stig Bjørlykke e73a89d91a Added option (-C) to check for SIZE constraints in octet-string, integer,
enumerated, sequence-of and set-of types.

Added BER functions to check for SIZE constraints and give expert info warnings.

svn path=/trunk/; revision=31309
2009-12-18 15:18:31 +00:00
Bill Meier 5d68a812ab Fix memory leak: re-init defragmentation tables each time a capture file is (re) opened.
svn path=/trunk/; revision=30589
2009-10-17 21:42:51 +00:00
Anders Broman f0aaa035a4 From Gerasimos Dimitriadis:
TCAP problem with indefinite length 'components' SEQ OF.
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=4053

svn path=/trunk/; revision=30319
2009-10-04 19:25:46 +00:00
Kovarththanan Rajaratnam 8b515e9340 Switch a bunch of dissectors over to using tvb_new_subset_remaining()
svn path=/trunk/; revision=29446
2009-08-16 12:36:22 +00:00
Kovarththanan Rajaratnam 5d5a5442d6 Don't guard col_set_str (COL_RES_DL_SRC/COL_RES_DL_DST) with col_check
svn path=/trunk/; revision=29343
2009-08-09 07:14:16 +00:00
Kovarththanan Rajaratnam e971354a54 Don't guard col_set_str (COL_PROTOCOL) with col_check
svn path=/trunk/; revision=29340
2009-08-09 06:26:46 +00:00
Stig Bjørlykke b228488bc0 From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
    for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
    FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero

svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
Anders Broman c91a384702 Apply some of the patches from:
http://wiki.wireshark.org/Development/Optimization

svn path=/trunk/; revision=28356
2009-05-13 19:46:11 +00:00
Guy Harris 39630a763d Squelch a warning.
svn path=/trunk/; revision=27947
2009-04-03 17:06:20 +00:00
Guy Harris cf308a6cc0 Don't reply on an argument of -1 as the last argument of tvb_memcpy()
meaning "to the end of the tvbuff"; we'd like to get rid of the "-1
means to the end of the tvbuff" convention, as in many cases the length
comes from a 32-bit length field in the packet, and we want 0xFFFFFFFF
to be treated, even on ILP32 platforms, as meaning "2^32-1 bytes",
probably giving an exception, rather than as "to the end of the packet".

svn path=/trunk/; revision=27945
2009-04-03 16:53:40 +00:00
Tomas Kukosa 494942c9c0 Display information which OID is not implemented in expert info
svn path=/trunk/; revision=27384
2009-02-06 13:48:32 +00:00
Bill Meier c544c20956 Fix various typos and spelling errors (mostly in text strings)
svn path=/trunk/; revision=27050
2008-12-18 19:08:49 +00:00
Stig Bjørlykke eb204d1ecf Added a filter entry when dissector for OID not implemented.
svn path=/trunk/; revision=26874
2008-11-29 11:17:34 +00:00
Stig Bjørlykke 4528043ab6 Fixed decoding of multiple sequences in a sequence of implict sequence.
Removed attempt to fix number of items in indef sequence-of and set-of.

svn path=/trunk/; revision=26476
2008-10-16 10:50:12 +00:00
Stig Bjørlykke c2515c5abd Count correct number of items in indef sequence-of and set-of.
svn path=/trunk/; revision=26451
2008-10-14 16:28:54 +00:00
Bill Meier b52d95d591 #include <emem.h> not req'd
svn path=/trunk/; revision=26091
2008-08-26 01:28:50 +00:00
Stig Bjørlykke d255e44bfa From Martin Peylo (bug 2507):
The attached patch enables asn2wrs.py and packet-ber.c to decode UTCTime
according to the definitions in X.680.

svn path=/trunk/; revision=25897
2008-08-01 16:44:06 +00:00
Bill Meier 7aaadd9bec Fix some warnings reported by gcc -Wshadow ...
svn path=/trunk/; revision=25616
2008-06-27 04:52:56 +00:00
Stig Bjørlykke 28ae535b00 Removed even more "statement not reached" warnings.
svn path=/trunk/; revision=24286
2008-02-07 15:44:45 +00:00
Anders Broman 14756d9e5d Let epan/asn1.c handle real type.
svn path=/trunk/; revision=24129
2008-01-18 05:55:24 +00:00
Sake Blok 6ff98095fe From Martin Peylo (bug 2184), fix for:
The current dissection of GeneralizedTime in packet-ber does not consider all
the possibilities how this field can be constructed.

According to ITU-T X.680 this field can be encoded as
YYYYMMDDhhmmss([\.,]f{1,3})?(([+-]hhmm)|Z)?
This is a regex-like expression where each letter except the literal 'Z'
represents an ASCII encoded digit.

So far only the first 14 digits are dissected and the 15th character is put
into parentheses. This may not show all available information.



svn path=/trunk/; revision=24071
2008-01-12 12:06:56 +00:00
Jeff Morriss db8bae4fb2 When searching for EOC (because we have an indefinite length) don't stop searching just because we ran out of TVB (thus assuming that the EOC is just beyond the end of the message). Instead, try to keep going which will throw an exception (ReportedBoundsError). I had a packet which was missing the EOC (probably programmer error) and Wirshark was reporting BoundsError (Packet size limited during capture) instead of ReportedBoundsError (Malformed Packet); this patch fixes that.
svn path=/trunk/; revision=24046
2008-01-09 17:06:25 +00:00
Anders Broman de16039c51 Get rid of dissect_ber_boolean_value() and change the signature of
dissect_ber_boolean() to return a value and update asn2wrs to generate the new signature.
Regenerate all BER dissectors.

svn path=/trunk/; revision=24015
2008-01-04 16:21:07 +00:00
Anders Broman 73fee653de Get rid of ber_last_created_item(). (Final?)
svn path=/trunk/; revision=24010
2008-01-04 13:39:24 +00:00
Anders Broman 6f5a53b789 Add more debug info.
svn path=/trunk/; revision=23977
2007-12-30 00:03:10 +00:00
Stig Bjørlykke 5e1ffde520 Moved check for empty choice to make it work correctly.
svn path=/trunk/; revision=23548
2007-11-23 12:22:22 +00:00
Stig Bjørlykke 92682d51de Added handling of octet-aligned data according to direct_reference.
Implemented handling of ber_callback for tagged type octet-aligned
and arbitrary.  Renamed some functions.

svn path=/trunk/; revision=23539
2007-11-21 23:33:13 +00:00
Stig Bjørlykke 8fc83d2cf3 Improved "BER Error" messages to be more uniform.
svn path=/trunk/; revision=23501
2007-11-19 20:23:49 +00:00
Stig Bjørlykke 9233fa7578 Second try to not stop processing if length==0 in choice.
svn path=/trunk/; revision=23497
2007-11-19 17:46:11 +00:00
Stig Bjørlykke 77e69e06e1 Reverted r23485 and r23486, this was not a correct fix.
svn path=/trunk/; revision=23489
2007-11-19 07:25:06 +00:00
Stig Bjørlykke c3d985077e And dump internal ber fields for empty choice field.
svn path=/trunk/; revision=23486
2007-11-18 16:40:20 +00:00
Stig Bjørlykke ddc4d639ba As proposed by Martin Peylo:
Do not stop processing if the length of a choice has the (illegal)
value of zero.

svn path=/trunk/; revision=23485
2007-11-18 16:20:51 +00:00
Graeme Lunt 4a285928bb Changed to use the the packet-ber EXTERNAL decoding (into the ASN1 context).
Uses the ber_callback mechanism to call the rtse oid callbacks, rather than the default ber oid callback list.
A couple of fixes to packet-ber.c to mark [in]direct references as present and call the ber_callback if it has been specified.


svn path=/trunk/; revision=23450
2007-11-14 20:57:55 +00:00
Anders Broman 524db0a082 From Florent DROUIN:
Since the use of the function 'dissect_ber_tagged_type' for DialoguePortion,
the file tcap.cnf must be updated to remove the decoding of the tag and length.
This decoding is now done in the new function 'dissect_ber_tagged_type'.

The file tcap.cnf has been updated to take into account this change. 
But this leads to a change in tcap.asn too, for the definition of the
ExternalPDU.
I think this part of the ASN1 file is specific to Wireshark and can be
modified.

In the meantime, I did update the DEBUG part for packet_ber.c  for the function
(dissect_ber_tagged_type)

svn path=/trunk/; revision=23442
2007-11-13 21:59:53 +00:00
Anders Broman dbcabb1938 Get rid of most of the legacy oid stuff.
svn path=/trunk/; revision=23333
2007-11-01 22:07:43 +00:00
Anders Broman 9492700608 Change:
get_oid_str_name() -> oid_resolved_from_string()
get_oid_name() -> oid_resolved_from_encoded()

svn path=/trunk/; revision=23331
2007-11-01 19:36:39 +00:00
Anders Broman 7329ae8ac6 Use oid_add_from_string for adding names.
fix compil of gsmmap and inap.
Note xcopy of gsmmap does not work(rename packet-gsm_map -> packet-gsmmap ?)

svn path=/trunk/; revision=23325
2007-10-31 23:11:15 +00:00
Anders Broman 1950ffc214 Apply the small performance enhancment patches for:
- if offset is 0, tvb_length is the same as tvb_length_remaining, just faster.
Replace 
- col_append_fstr() with faster  col_append_str() 
- col_add_str() with col_set_str()
when it's safe

svn path=/trunk/; revision=23252
2007-10-23 05:50:00 +00:00
Luis Ontanon bcd55f4c8e replace oid_to_str_buf() and oid_to_str()
fix a potential buffer overflow due to a very liberal estimate by oid_repr_len()


svn path=/trunk/; revision=22659
2007-08-25 17:29:55 +00:00
Luis Ontanon 00c5e48a17 get users of oid_resolv to use the new oids, rollout packet-snmp.c
svn path=/trunk/; revision=22651
2007-08-25 01:14:24 +00:00
Jörg Mayer 93f5beda89 Warning fixes
svn path=/trunk/; revision=22629
2007-08-24 10:20:22 +00:00
Jörg Mayer 733f78043e The ber header was missing from the object, resulting in
invalid saved certificates.

svn path=/trunk/; revision=22628
2007-08-24 08:12:39 +00:00
Jörg Mayer b312e64f6a get_ber_length doesn't need the tree argument, get rid of it.
Rebuild asn1 dissectors.

svn path=/trunk/; revision=22627
2007-08-24 07:12:04 +00:00