aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-ber.c
AgeCommit message (Collapse)AuthorFilesLines
2014-06-18Fixup: tvb_* -> tvb_capturedDario Lombardo1-69/+69
Change-Id: I9209c1271967405c34c1b6fa43e1726a4d3a5a3f Reviewed-on: https://code.wireshark.org/review/2377 Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-06-18Fixup: tvb_get_string(z) -> tvb_get_string(z)_encDario Lombardo1-3/+3
Change-Id: I63a3704effe3fcab01a193dc39b6a22e9f1cf3fe Reviewed-on: https://code.wireshark.org/review/2376 Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-06-17fix underflow in BER constrained bitstringsEvan Huus1-1/+1
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-16Register BER dissector as new.Stig Bjørlykke1-5/+8
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-07tvb_new_subset -> tvb_new_subset_length when length parameters are equal.Michael Mann1-8/+8
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-05-06Tweak ber_choice flow control.Evan Huus1-2/+2
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-04-18Remove all old BER functions.Stig Bjørlykke1-1120/+0
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-07Absolute and relative OIDs have different FT_ values.Guy Harris1-1/+5
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-07Handle string types with somewhat appropriate encodings.Guy Harris1-1/+81
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-03-04Remove all $Id$ from top of fileAlexis La Goutte1-2/+0
(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-02-03Fix all -fstrict-alias warnings found by gcc 4.1.2Gilbert Ramirez1-1/+1
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-01-27Add missing cast.Evan Huus1-1/+1
svn path=/trunk/; revision=54980
2014-01-27Do not handle BER bitstring as ASCII string, because this will failStig Bjørlykke1-1/+1
when the first bit is set. svn path=/trunk/; revision=54977
2013-12-21Add missing includesJakub Zawadzki1-0/+1
svn path=/trunk/; revision=54332
2013-12-19Rename a couple of to_str functions to have ep_ in the name. This makes itEvan Huus1-1/+1
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-10Get the "Decode As" dialog working, albeit with a few warts. It differsGerald Combs1-1/+1
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-11-20Mark parameter as unusedAnders Broman1-1/+1
packet-ber.c:391: warning: unused parameter 'table_name' svn path=/trunk/; revision=53447
2013-11-20Provide "Decode As" functionality through dissectors themselves instead of ↵Michael Mann1-0/+56
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-10Add missing includes in order to remove exceptions.h from proto.h (next commit).Jakub Zawadzki1-0/+1
svn path=/trunk/; revision=53230
2013-11-02Require dissector_try_string to pass a data parameter to its subdissectors. ↵Michael Mann1-3/+3
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-10-31Add a data parameter to call_ber_oid_callback to be able to pass data to ↵Michael Mann1-5/+5
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-23#if 0 numerous "unused const variables" (mostly value-string-arrays);Bill Meier1-0/+2
Also; fix a few "set but not used" warnings. svn path=/trunk/; revision=52780
2013-10-13whitespace fixes; mostly: remove trailing blanksBill Meier1-6/+6
svn path=/trunk/; revision=52591
2013-10-06From Ed Beroset via https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9192 :Pascal Quantin1-102/+27
Cleanup of relative and absolute OID decoding in packet-ber.c svn path=/trunk/; revision=52420
2013-10-06Add support for RELATIVE-OID ASN.1 type. Bug 9192 ↵Michael Mann1-9/+107
(https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9192) From Ed Beroset. svn path=/trunk/; revision=52393
2013-09-30Convert some proto_tree_add_string_format calls to something more appropriate.Michael Mann1-98/+98
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-22emem -> wmem conversion:Pascal Quantin1-4/+4
- 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-20Indicate Sequence of 0 length.Anders Broman1-0/+3
svn path=/trunk/; revision=52155
2013-09-12Convert a few more dissectors to wmemPascal Quantin1-5/+7
svn path=/trunk/; revision=51991
2013-09-09expert_add_info_format_text -> expert_add_info_formatMichael Mann1-27/+27
svn path=/trunk/; revision=51852
2013-08-05Keep result of [new_]register_dissector in some dissectors. [2 of x]Jakub Zawadzki1-3/+5
(don't create new dissector handle if we can use already existing one) svn path=/trunk/; revision=51159
2013-07-17Remove fragment_data, add fragment_head, fragment_item - for now alias it to ↵Jakub Zawadzki1-1/+1
the same structure. This is begin of work to split fragment head and fragments items. svn path=/trunk/; revision=50708
2013-07-14Rewrite reassemble API to use TVBs instead of raw data.Jakub Zawadzki1-1/+1
(it seems to be working for TCP ^^) svn path=/trunk/; revision=50580
2013-07-02Make expert items filterable. First use of proto_tree_add_expert.Michael Mann1-203/+175
svn path=/trunk/; revision=50327
2013-06-20Fix https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8799 :Pascal Quantin1-3/+5
Display certificate as UINT64 and add support for a 64bits unsigned value in BER dissector svn path=/trunk/; revision=50096
2013-06-19Rework the change from r15595 a bit: when creating a TVB subset, always giveJeff Morriss1-6/+13
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-04-30Follow-up to r49055 as noted onEvan Huus1-1/+4
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-26From me: only sign-extend BER integers if the field is actually signedEvan Huus1-3/+4
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-20Initialize branch_taken right at the top of dissect_ber_choice so that theEvan Huus1-3/+4
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-03-22Don't wire into the reassembly code the notion that reassemblies shouldGuy Harris1-7/+5
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-17From beroset:Anders Broman1-1/+1
remove C++ incompatibilities https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8416 svn path=/trunk/; revision=48355
2013-03-15[-Wmissing-prototypes]Anders Broman1-6/+9
Use explicit casts. svn path=/trunk/; revision=48319
2013-02-26Fix spelling/typos found using a list of commonly misspelled words.Bill Meier1-2/+2
The misspellings were mostly in comments but some were in text strings visible to the user. svn path=/trunk/; revision=47899
2013-02-26it's ==> its & its ==> it's as needed.Bill Meier1-2/+2
svn path=/trunk/; revision=47891
2012-12-21Constify some character pointer variables to avoid warnings aboutGuy Harris1-1/+1
strings being assigned to them. svn path=/trunk/; revision=46653
2012-10-18Reformat for readability:Bill Meier1-1400/+1798
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-09-20We always HAVE_CONFIG_H so don't bother checking whether we have it or not.Jeff Morriss1-3/+1
svn path=/trunk/; revision=45017
2012-09-07From Robert Bullen via ↵Jeff Morriss1-0/+2
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-08-14more ephemeral memory cleanupMichael Mann1-14/+13
svn path=/trunk/; revision=44496
2012-08-10Use val_to_str_const() where appropriate;Bill Meier1-45/+47
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