Commit Graph

53 Commits

Author SHA1 Message Date
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
Michael Mann b38ee917b1 Convert proto_tree_add_uint_format to proto_tree_add_uint_format_value if hf_ field name is the first part of the formatted string. This was done with a perl script on the dissectors directory (packet-*.c), followed by manual inspection of the output. The manual inspection yielded a few cases that really should have been proto_tree_add_uint or proto_tree_add_item, so I updated them accordingly.
The script didn't catch as many as I would have liked, but it's a start.

The most common (ab)use of proto_tree_add_uint_format was for appending strings to CRC/checksum values to note good or bad CRC/checksum.

svn path=/trunk/; revision=52045
2013-09-15 01:48:30 +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
Michael Mann e597acdc48 Batch of filterable expert info.
svn path=/trunk/; revision=51625
2013-09-01 13:05:27 +00:00
Martin Kaiser 07ee14d5c1 fix https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9020
make sure that the loop counter is always incremented

svn path=/trunk/; revision=51196
2013-08-07 21:17:53 +00:00
Bill Meier 8d5bbb4146 Define certain 'const char *...' arrays as static.
Reduces code memory usage and execution time.
(See SVN #50271)


svn path=/trunk/; revision=50292
2013-07-01 13:03:23 +00:00
Jeff Morriss 779d28d390 Fix the fuzz failure reported (by me) in https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8764 :
Apply the fix from bug 8539 (r48796) to another function (dissect_r3_upstreamcommand_queryconfig()):

Bail out of the item length we get (which we use to increment the offset) is 0.
Otherwise the offset does not advance and we loop forever.

While we're in there: get the item length just once (there's no need to call
tvb_get_guint8() a half dozen times when one will do).

svn path=/trunk/; revision=49744
2013-06-04 02:01:53 +00:00
Jeff Morriss cfd03173b4 Fix the fuzz failure reported in https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8539 :
Bail out of the item length we get (which we use to increment the offset) is 0.
Otherwise the offset does not advance and we loop forever.

While we're in there: get the item length just once (there's no need to call
tvb_get_guint8() a half dozen times when one will do).

svn path=/trunk/; revision=48796
2013-04-09 02:05:39 +00:00
Evan Huus 37600a157b Rename value string (and similar) functions to use a consistent pattern. This
was done using textual search+replace, not anything syntax-aware, so presumably
it got most comments as well (except where there were typos).

Use a consistent coding style, and make proper use of the WS_DLL_* defines.

Group the functions appropriately in the header.

I ended up getting rid of most of the explanatory comments since many of them
duplicated what was in the value_string.c file (and were out of sync with the
recent updates I made to those in r48633). Presumably most of the comments
should be in the .h file not the .c file, but there's enough churn ahead that
it's not worth fixing yet.

Part of https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8467

svn path=/trunk/; revision=48634
2013-03-29 00:26:23 +00:00
Anders Broman 6bde918078 From beroset:
remove C++ incompatibilities 
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8416

svn path=/trunk/; revision=48426
2013-03-19 20:00:52 +00:00
Anders Broman 04766017df - [-Wmissing-prototypes]
- explicit casts.

svn path=/trunk/; revision=48282
2013-03-13 21:14:20 +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
Jeff Morriss 70eecf2392 Move ett and hf arrays into proto_register routine.
Reindent some.

svn path=/trunk/; revision=46495
2012-12-11 02:26:44 +00:00
Jeff Morriss 97bbd2fc0a Fix inifite loop in the R3 dissector reported in
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8040 :

If the alarm length is 0, raise an expert_info and break out of the loop.

svn path=/trunk/; revision=46415
2012-12-06 01:43:37 +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
Chris Maynard 590cec6962 tvb_length_remaining() can return -1, so be sure to deal with it if it does. Should fix a bunch of Coverity CID's.
svn path=/trunk/; revision=43715
2012-07-14 19:28:40 +00:00
Bill Meier 59e9b969e9 Fix [-Werror=sign-compare] compiler warning
svn path=/trunk/; revision=43666
2012-07-11 18:43:30 +00:00
Bill Meier 85504b052f Simplify code ....
svn path=/trunk/; revision=43665
2012-07-11 18:32:20 +00:00
Bill Meier 3b7e75852a Remove "comment to myself".
svn path=/trunk/; revision=43664
2012-07-11 16:24:01 +00:00
Bill Meier 0bace7313c General cleanup:
- Fix potential array overflow;
- Calls to expert...() should not be under 'if (tree)';
- Don't use DISSECTOR_ASSERT for bad data; use expert...();
- Add some XXX comments about enum item values different than
   specified in the comments associated with the enum items;
- Init global 'mfgCommandFlag' as appropriate before use;
- Add missing hf[] entries;
- #if 0 various unused #defines and enums;
- Reduce (somewhat) repeated fetches of the same tvb data;
- Remove unneeded initializers;
- Don't use 'l' as a variable name;
- Reformat long lines, hf[] array entries and other;;
- Fix some indentation;

svn path=/trunk/; revision=43663
2012-07-11 15:28:31 +00:00
Bill Meier 3be39a23aa From Evan Huus: Struct cleanup in packet-assa_r3.c
Cleanup and simplify structures and arrays in packet-assa_r3.c as described in
my email to the -dev list [1].

[1] http://www.wireshark.org/lists/wireshark-dev/201207/msg00050.html


From me:
 Do the same as above for the commandDissectorParser_t struct mentioned in the EMail
 (but not fixed in the patch).


svn path=/trunk/; revision=43623
2012-07-09 03:00:03 +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
Bill Meier 2ed4baea4f all:
Merge .h files into .c files since .h files unused elsewhere;
     Do whitespace, indentation & formatting cleanup.
packet-acn.c:
     Fix 2 minor bugs wherein subtree not displayed in packet-details
     because tree variable used in proto_tree_add_text() always NULL.

svn path=/trunk/; revision=42647
2012-05-16 01:41:03 +00:00
Guy Harris 761ce3c75b Get rid of remaining Booleans-as-encoding-arguments in
proto_tree_add_item() calls; for the items that don't actually have hf_
entries (which is a bug in the dissector!), assume the short
fixed-length ones are integral and the "to the end of the packet" ones
are byte arrays (hence ENC_NA).

svn path=/trunk/; revision=42475
2012-05-07 18:00:13 +00:00
Anders Broman e6b7af69b5 From Evan Huus: There were two cases where we could underflow an unsigned subtraction, leading to huge values and near-infinite loops. Catch them and add an expert_info warning that the packet is bad. Also fix some other expert_info messages to hang off of the right dissection tree. https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=7125
svn path=/trunk/; revision=42122
2012-04-18 05:29:02 +00:00
Bill Meier 4f8e416fdc Fix benign issue: For FT_BOOLEAN fields with a zero bitmask, use BASE_NONE for 'display'
svn path=/trunk/; revision=41385
2012-03-06 22:12:42 +00:00
Bill Meier 54b72021bb Fix encoding arg for various fcn calls:
- proto_tree_add_bits_item
 - proto_tree_add_bits_ret_val
 - proto_tree_add_bitmask
 - tvb_get_bits
 - tvb_get_bits16
 - tvb_get_bits24
 - tvb_get_bits32
 - tvb_get_bits64


svn path=/trunk/; revision=39539
2011-10-24 19:57:53 +00:00
Bill Meier 63e83b1303 Fix a proto_tree_add_item() encoding arg.
svn path=/trunk/; revision=39527
2011-10-23 20:50:48 +00:00
Bill Meier 794757ae8f For proto_tree_add_item(..., proto_xxx, ...)use ENC_NA as the encoding arg.
Also: remove trailing whitespace for a number of files.

svn path=/trunk/; revision=39503
2011-10-21 02:10:19 +00:00
Bill Meier 126aa85393 Convert proto_tree_add_item() 'encoding' arg for field types FT_STRING, FT_STRINGZ, FT_UINT_STRING as follows:
1. If there's no character encoding (ENC_ASCII, ...) specified
    then use ENC_ASCII.
 2. For all but FT_UINT_STRING, always use ENC_NA
    (replacing any existing True/1/FALSE/0
    /ENC_BIG_ENDIAN/ENC_LITTLE_ENDIAN).



svn path=/trunk/; revision=39426
2011-10-15 18:46:26 +00:00
Bill Meier e81572eaa9 Comment out some unused hf[] entries;
Add notes about missing hf[] entries.

svn path=/trunk/; revision=39344
2011-10-10 20:57:56 +00:00
Bill Meier a78fdcfddc Convert proto_tree_add_item() 'encoding' parameter as appropriate.
svn path=/trunk/; revision=39343
2011-10-10 20:12:57 +00:00
Bill Meier 67ee5049d4 Convert 'encoding' parameter of certain proto_tree_add_item() calls in non-autogenerated epan/dissectors:
Specifically:  Replace FALSE|0 and TRUE|1 by ENC_BIG_ENDIAN|ENC_LITTLE_ENDIAN as
  the encoding parameter for proto_tree_add_item() calls which directly reference
  an item in hf[] which has a type of:
     FT_BOOLEAN
     FT_IPv4
     FT_EUI64
     FT_GUID
     FT_UINT_STRING

Also: For type FT_ITv6 use ENC_NA. (This was missed in SVN #39260)

svn path=/trunk/; revision=39328
2011-10-10 00:39:31 +00:00
Bill Meier 4e57694d4a Convert 'encoding' parameter of certain proto_tree_add_item() calls in non-autogenerated epan/dissectors:
Specifically:  Replace FALSE|0 and TRUE|1 by ENC_BIG_ENDIAN|ENC_LITTLE_ENDIAN as
 the encoding parameter for proto_tree_add_item() calls which directly reference
 an item in hf[] which has a type of:
    FT_UINT8
    FT_UINT16
    FT_UINT24
    FT_UINT32
    FT_UINT64
    FT_INT8
    FT_INT16
    FT_INT24
    FT_INT32
    FT_INT64
    FT_FLOAT
    FT_DOUBLE


svn path=/trunk/; revision=39288
2011-10-06 03:35:44 +00:00
Bill Meier 94f36ca4ff Use ENC_NA as encoding for proto_tree_add_item() calls which directly reference an hf item (in hf[] with types:
FT_NONE
   FT_BYTES
   FT_IPV6
   FT_IPXNET
   FT_OID

Note: Encoding field set to ENC_NA only if the field was previously TRUE|FALSE|ENC_LITTLE_ENDIAN|ENC_BIG_ENDIAN

svn path=/trunk/; revision=39260
2011-10-04 22:44:31 +00:00
Stig Bjørlykke 5359494b1f Second try to move crc routines to libwsutil.
This time keep the tvb routines in epan.

Now we can use common crc routines outside epan.

svn path=/trunk/; revision=38810
2011-08-31 09:00:54 +00:00
Stig Bjørlykke 71f903b956 Revert r38800, as the crc routines contains some tvb functions.
svn path=/trunk/; revision=38803
2011-08-30 14:17:40 +00:00
Stig Bjørlykke 4132d40e50 Move all crc routines to libwsutil.
This way we can use the crc routines in wiretap.

svn path=/trunk/; revision=38800
2011-08-30 13:46:42 +00:00
Stephen Fisher 9a8c084580 Found by clang 3.0 (built from trunk): various implicit conversion from
enumeration type 'xxx' to different enumeration type 'xxx'

Fix: Create different structs based on the enum type contained within.


svn path=/trunk/; revision=36814
2011-04-22 16:27:01 +00:00
Alexis La Goutte 56c8001d3c Fix Dead Store (Dead assignement/Dead increment) Warning found by Clang
svn path=/trunk/; revision=36764
2011-04-21 13:43:23 +00:00
Alexis La Goutte ace0276b1c Fix Dead Store (Dead nested assignment) Warning found by Clang
svn path=/trunk/; revision=36753
2011-04-21 13:31:42 +00:00
Stephen Fisher fc7b0c019b Fix the dead initialization warnings found by clang's static analysis
("Value stored to 'xxx' during its initialization is never read")


svn path=/trunk/; revision=35598
2011-01-20 18:56:11 +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
Bill Meier 03b57df5a0 Fix various typos and spelling errors.
svn path=/trunk/; revision=35126
2010-12-06 01:34:58 +00:00
Bill Meier d318d360d5 Use value_string_ext fcns when accessing value_string arrays.
svn path=/trunk/; revision=34744
2010-11-01 17:11:04 +00:00
Bill Meier e7568712ef Define some fcns & vars as static;
Minor whitespace and comments cleanup.

svn path=/trunk/; revision=34477
2010-10-11 19:00:55 +00:00
Guy Harris 8084fd5152 Squelch a compiler warning.
svn path=/trunk/; revision=32414
2010-04-07 00:41:44 +00:00
Gerasimos Dimitriadis 20e77097eb Fix for Bug 4369:
Use the correct function for adding an FT_STRING field and make some
checks regarding the length of parameters in cmd_manageuser().

svn path=/trunk/; revision=31476
2010-01-10 14:29:49 +00:00
Gerasimos Dimitriadis e53c76e9af Partial fix for Bug 4369:
Remove the possibility of infinite loop when counting items of length 0.

svn path=/trunk/; revision=31475
2010-01-10 14:00:49 +00:00