Commit Graph

508 Commits

Author SHA1 Message Date
Gerald Combs c9d4240196 Add a context menu to the packet list and fill in the
apply/match-related actions. Have matchSelectedFilter figure out our
filter strings, which lets us remove duplicate code in the apply/match
action slots. Remove some leftover code from an experiment.

Adjust the temporary message colors in the status bar and label stack.

Add a NULL check to construct_match_selected_string.

svn path=/trunk/; revision=46449
2012-12-07 20:08:00 +00:00
Jeff Morriss da4442d638 Use g_error() to generate an explanatory message (and a core) when
ABORT_ON_DISSECTOR_BUG is set and we pass MAX_TREE_ITEMS.

If ABORT_ON_DISSECTOR_BUG is set and we get an unregistered hf, generate
an explanatory message (and a core).

svn path=/trunk/; revision=46323
2012-12-02 03:34:06 +00:00
Anders Broman 94fb28dfa1 Check if we have a filter name.
svn path=/trunk/; revision=46077
2012-11-18 18:12:50 +00:00
Jakub Zawadzki bdcdec560c Manually revert r45669
svn path=/trunk/; revision=45884
2012-11-03 20:51:19 +00:00
Jakub Zawadzki ff03289b1a Remove const specifier from argument.
svn path=/trunk/; revision=45872
2012-11-02 11:44:50 +00:00
Jeff Morriss d97b4ec325 Fix problem where NTP times with the high-bit set to 0 (which RFC 2030
chapter 3 has redefined to mean years *after* 2036) were being represented as
times prior to 1968.

This has been broken since r35840 (apparently not many people see NTP
timestamps beyond 2036 :-)): apparently I over-optimized packet-ntp's code
while copying it into proto.c: that temporary variable is necessary for the
unsigned math to happen correctly before assigning the result to the (signed)
time_t.

Leave a comment in the code indicating why the temporary variable is needed.
Copy that comment to packet-ntp.c.

Fix the same problem in ntp_to_nstime(): it also did not use the temporary variable.

svn path=/trunk/; revision=45790
2012-10-25 22:26:52 +00:00
Jakub Zawadzki 6dc977b7d2 - Allow reseting edt with new function epan_dissect_reset(),
- initialize edt once in few places, and later reset it after dissecting
  (add_packet_to_packet_list),
- revert r45667, probably no longer needed.

svn path=/trunk/; revision=45669
2012-10-20 16:44:55 +00:00
Jakub Zawadzki ef72e0eed3 - Free root node and tree data outside proto_tree_free_node,
- remove #if 0 code.

svn path=/trunk/; revision=45668
2012-10-20 16:38:55 +00:00
Jeff Morriss 3729335973 We always HAVE_CONFIG_H so don't bother checking whether we have it or not.
svn path=/trunk/; revision=45016
2012-09-20 01:48:30 +00:00
Martin Mathieson d729f21ad2 Revert r45005.
svn path=/trunk/; revision=45006
2012-09-19 16:56:59 +00:00
Martin Mathieson a232ae9242 Make proto_item_append_string() behave sanely, and use it in a few more
dissectors.

svn path=/trunk/; revision=45005
2012-09-19 11:58:32 +00:00
Jeff Morriss f90f3f3438 Don't fetch the value twice (unsigned integer case). Fix a cut-n-pasteo.
svn path=/trunk/; revision=44757
2012-09-03 19:33:45 +00:00
Jakub Zawadzki 1db996e051 MT: move global field_info_tmp to tree_data_t
svn path=/trunk/; revision=44747
2012-09-03 12:00:08 +00:00
Evan Huus 2af3ce88bd From Martin Kupec via https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=7658
Don't pass string-related encoding flags to get_uint_value() when handling
FT_UINT_STRING fields. This was causing all such fields with non-ASCII
encodings to use little-endian encoding, even when OR-ed with ENC_BIG_ENDIAN.

(not actually the topic of the above bug, but discovered during LLRP protocol
 testing, which was the topic of the above bug)

svn path=/trunk/; revision=44619
2012-08-23 02:48:26 +00:00
Gerald Combs a9f5507086 Keep field_info_tmp from being prematurely freed. Better fix for bug 7621.
svn path=/trunk/; revision=44478
2012-08-13 22:43:17 +00:00
Gerald Combs 517ef559c2 Fix a copy/paste error which triggered bug
svn path=/trunk/; revision=44456
2012-08-12 15:48:36 +00:00
Gerald Combs 72ddab2c98 Instead of calling DISSECTOR_ASSERT() whenever we get an invalid length,
add an expert item. For unusable lengths throw ReportedBoundsError but
try to continue on otherwise.

Based on a patch from Mike Morrin in bug 3884.

svn path=/trunk/; revision=44439
2012-08-10 23:05:04 +00:00
Gerald Combs cd3cca7edc Make the corresponding packet_info available to each tree item. This
lets us pass a NULL pinfo to expert_add_info_format() and
expert_add_undecoded_item(), which makes it possible to use those
routines deep in the bowels of many dissectors. As a proof of concept
remove the recent pinfo additions to packet-afp.c. This should also make
it easier to fix bug 3884.

svn path=/trunk/; revision=44435
2012-08-10 20:33:01 +00:00
Jeff Morriss d380312c16 Move the pi==NULL test into TRY_TO_FAKE_THIS_REPR.
Since the tree will only be NULL here if someone messed up in proto.c and
since pi will only be NULL if tree is NULL, assert out if either of them are
NULL (don't use DISSECTOR_ASSERT() since such a condition wouldn't be the
dissector writer's fault).

Use TRY_TO_FAKE_THIS_REPR in ptvcursor_add_text_with_subtree().

We've had TRY_TO_FAKE_THIS_REPR for a long time now, don't wrap it in #if 1.

new_field_info() doesn't return NULL so don't check for it returning NULL in
ptvcursor_add().

svn path=/trunk/; revision=44322
2012-08-08 03:02:27 +00:00
Guy Harris 835111692f From Richard Stearn: support for AX.25, including support for
LINKTYPE_AX25.

svn path=/trunk/; revision=44211
2012-08-02 16:54:43 +00:00
Jakub Zawadzki c852982ebc wrappers for label filling (with information about string truncation)
svn path=/trunk/; revision=44131
2012-07-30 10:52:20 +00:00
Jeff Morriss 3fa645481f Followup to r43176, r43177, r43178, and r43179: prohibit FT_*INT*
with BASE_NONE (or other future display values).

Don't use BASE_NONE with FT_UINT32s in the expert info fields.

svn path=/trunk/; revision=43412
2012-06-20 17:25:53 +00:00
Jakub Zawadzki 85aad38347 Add proto_tree_add_unicode_string() to add UTF-8 string to tree.
Convert some proto_tree_add_string_format_value(..., val, "%s", val); to use new function.

svn path=/trunk/; revision=43363
2012-06-19 14:32:24 +00:00
Bill Meier 08807fc48d Fix "BASE_CUSTOM field is incorrectly formatted when applied as a column".
Resolves Bug #6671 - https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=6671

svn path=/trunk/; revision=43186
2012-06-10 19:23:50 +00:00
Bill Meier 2968fcffa8 Fix bug wherein values in a custom column aren't displayed as a value_string (when appropriate).
Essentially: BASE_CUSTOM is "base_display_e value" (like BASE_DEC) *not* a bit-mask
 (like BASE_EXT_STRING).
Bug introduced in SVN #39902

svn path=/trunk/; revision=43184
2012-06-10 15:10:11 +00:00
Bill Meier d01cb597c9 Don't crash in 'proto_registrar_dump_values' if BASE_EXT_STRING and no extended string.
Note: this shows up when doing 'tshark -G values'.

BASE_EXT_STRING with a missing extended string does *not* cause issues
with the normal display code:

ToDo (eventually): Add some code to enforce requirement that hf[] entries with BASE_EXT_STRING
(or BASE_RANGE_STRING) set must also have a 'strings' value.



svn path=/trunk/; revision=43150
2012-06-07 21:10:02 +00:00
Chris Maynard 3e52049ff5 Fix Coverity CID's 702388 and 702422: OVERFLOW_BEFORE_WIDEN.
svn path=/trunk/; revision=42886
2012-05-28 18:37:10 +00:00
Jakub Zawadzki 5020a3f170 While iterating over string characters don't use strlen(), but check for NUL.
svn path=/trunk/; revision=42883
2012-05-28 15:59:00 +00:00
Bill Meier 12ba85a2a4 Rework proto_registrar_dump_protocols() to prevent a Clang scan-build "de-reference of a null poiunter" warning
(In practice, bug would not actually occur).

svn path=/trunk/; revision=42717
2012-05-19 16:07:50 +00:00
Jakub Zawadzki 91690d8a28 Fix string buffer overflow (bug #7029)
g_strlcpy() always return the size of strlen(src), so in case of truncation it could happen that offset_r > size or offset_e > size.
Fix it by adding new function protoo_strlcpy() which returns how many bytes was copied to dest buffer.


svn path=/trunk/; revision=42676
2012-05-17 10:18:53 +00:00
Guy Harris 7a87d7b6a3 Add ENC_UTF_16 and ENC_UCS_2. Note that UTF-16 and UCS-2 are not the
same, and that the routines to get "Unicode" strings are really doing
UCS-2 (and not doing anything about code values that aren't valid in
UCS-2 strings).

Have tvb_get_ephemeral_string_enc() separate cases for ASCII and UTF-8,
even though they're *currently* treated the same.

For FT_UINT_STRING, treat an encoding value of TRUE as meaning
"little-endian ASCII"; pass all other encodings through to
tvb_get_ephemeral_string_enc().

svn path=/trunk/; revision=42592
2012-05-11 23:55:54 +00:00
Guy Harris f1b11f62f8 proto_registrar_get_ftype() returns an FT_ value; make its return type
"enum ftenum" to reflect that, and fix the "switch doesn't handle XXX"
warnings that provokes.

svn path=/trunk/; revision=42579
2012-05-11 17:29:56 +00:00
Anders Broman 0cea399fda From Jakub Zawadzki: Use custom model in Filter Expression dialog.
svn path=/trunk/; revision=42411
2012-05-04 04:44:23 +00:00
Jakub Zawadzki e6f2751cdd Add support for checking conflicting entries in value_string_ext.
svn path=/trunk/; revision=42262
2012-04-26 15:33:46 +00:00
Anders Broman b02b6a932f From Evan Huus: Use Add DISSECTOR_ASSERT_HINT() macro. https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=7142
svn path=/trunk/; revision=42148
2012-04-20 05:12:20 +00:00
Gerald Combs 8b3024e57c Make bit_offset in _tvb_get_bits64 and related functions unsigned. This
removes a potential buffer overflow and should fix a bunch of Coverity
errors mentioned in bug 6878.

We might want to do the same for no_of_bits.

svn path=/trunk/; revision=41945
2012-04-04 21:54:22 +00:00
Bill Meier ad9f8fffad Update a comment as to the number of Wireshark protocols;
Minor whitespace and formatting changes.

svn path=/trunk/; revision=41559
2012-03-15 14:15:48 +00:00
Bill Meier e0397b3811 Fix up a several REPORT_DISSECTOR_BUG messages to specify the correct function name;
Do general cleanup:
- Indentation & whitespace;
- Reformat long lines,
- & etc.

svn path=/trunk/; revision=41547
2012-03-14 17:11:39 +00:00
Stig Bjørlykke da8cd5d5bd Value can't be negative if no_of_bits == 0
svn path=/trunk/; revision=41507
2012-03-12 17:18:04 +00:00
Anders Broman 230eb02a41 From Sylvain Munaut: proto_tree_add_split_bits_item_ret_val doesn't handle signed value properly https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=6920
svn path=/trunk/; revision=41419
2012-03-08 06:11:20 +00:00
Anders Broman bfcf193d2f Increase the size of the preallocated area for hf fields.
svn path=/trunk/; revision=41290
2012-03-02 09:28:30 +00:00
Jeff Morriss a146f5a2e2 (After a couple of years of warning about this), assert out if someone tries
to register an hf with an empty-string abbreviation.

svn path=/trunk/; revision=41280
2012-03-01 22:00:33 +00:00
Anders Broman b28516dc00 From Mike Morrin: A small patch to correct the name of the function proto_tree_add_split_bits_item_ret_val()
svn path=/trunk/; revision=41255
2012-03-01 07:01:15 +00:00
Anders Broman 597047d253 From Mike Morrin:
The attached patches add the ability to dissect split bit-strings as discussed under bug 6797.
proto_tree_add_split_bits_ret_val()
proto_tree_add_split_bits_crumb()

svn path=/trunk/; revision=41246
2012-02-29 17:13:43 +00:00
Jeff Morriss 21a422463e If WIRESHARK_ABORT_ON_DISSECTOR_BUG is set (in the environment) and we put more
than MAX_TREE_ITEMS in the tree, abort() out rather than throwing an exception.

svn path=/trunk/; revision=41009
2012-02-13 03:14:46 +00:00
Jeff Morriss 2f240acc2e Fix a couple of cut-n-pasteos.
svn path=/trunk/; revision=40711
2012-01-25 01:24:25 +00:00
Jörg Mayer 71520b8759 Remove obsolete GLIB_CHECK_VERSION(2,10,0) checks
svn path=/trunk/; revision=40490
2012-01-14 03:21:28 +00:00
Gerald Combs 3c1b8a6ca1 Add a "-G ftypes" option, which dumps our supprted FT_… names and
descriptions. Captitalize and fix up the descriptions. Use its output to
create the field type list in the wireshark-filter man page.

svn path=/trunk/; revision=40306
2011-12-27 20:35:41 +00:00
Stephen Fisher 4af334a549 Improve this error message (example output based on attachment in bug #6665):
OOPS: ',' in 'tpncp.fxs_ana,og_voltage_beading'

Now:

    Invalid character ',' in filter name 'tpncp.fxs_ana,og_voltage_beading'


svn path=/trunk/; revision=40256
2011-12-20 21:53:50 +00:00
Chris Maynard a71316964f Fix crash caused by trying to apply a field of type BASE_CUSTOM as a column. Fixes https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=6503.
svn path=/trunk/; revision=39902
2011-11-17 15:57:44 +00:00