Commit Graph

63 Commits

Author SHA1 Message Date
João Valverde 40ec1adfb0 S7Comm: Fix invalid UTF-8 value string chars
Fixes #18533.
2022-10-26 01:42:43 +01:00
Benedikt Heumüller 893290c603 Extended range_string to 64 bit 2022-01-05 09:14:46 +00:00
Moshe Kaplan 1c3a9af869 Add files with WS_DLL_PUBLIC to Doxygen
Add @file markers for most files that
contain functions exported with
WS_DLL_PUBLIC so that Doxygen will
generate documentation for them.
2021-11-29 21:27:45 +00:00
João Valverde 133b0c583f Move epan/wmem/wmem_scopes.h to epan/
This header was installed incorrectly to epan/wmem_scopes.h.

Instead of creating additional installation rules for a single
header in a subfolder (kept for backward compatibility) just
rename the standard "epan/wmem/wmem.h" include to
"epan/wmem_scopes.h" and fix the documentation.

Now the header is installed *correctly* to epan/wmem_scopes.h.
2021-07-26 14:56:11 +00:00
Guy Harris 1e1f4e6b5f Move more headers outside extern "C".
If a header declares a function, or anything else requiring the extern
"C" decoration, have it wrap the declaration itself; don't rely on the
header itself being included inside extern "C".
2021-03-16 02:36:10 -07:00
Michal Ruprich c8246c9973 Moving glib.h out of extern C 2021-02-10 17:49:09 +00:00
Anders Broman 5b91801a8d value_string: Change the bytes_string struct to avoid Wpointer-sign
Change-Id: Ie9db520f73dbbf61a6aecb37cf5ed8839f3e1052
Reviewed-on: https://code.wireshark.org/review/37770
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2020-07-08 06:43:55 +00:00
Anders Broman a8d5920caf tls_utils: Try to fix -Wpointer-sign warnings.
Change-Id: Ia03499ae77dbbc840dc50ecf3ce56c399d939a6a
Reviewed-on: https://code.wireshark.org/review/37729
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2020-07-06 12:14:22 +00:00
Guy Harris 20800366dd HTTPS (almost) everywhere.
Change all wireshark.org URLs to use https.

Fix some broken links while we're at it.

Change-Id: I161bf8eeca43b8027605acea666032da86f5ea1c
Reviewed-on: https://code.wireshark.org/review/34089
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2019-07-26 18:44:40 +00:00
Tom Hughes 99c62bf797 Add support for extended 64 bit value to string matching
This adds val64_string_ext to parallel value_string_ext in the
same way that val64_string parallels value_string.

Change-Id: Iadbfc49f5a4540000ed92fd0469e8d273911e97e
Reviewed-on: https://code.wireshark.org/review/30385
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-10-27 05:34:59 +00:00
Dario Lombardo 55c68ee69c epan: use SPDX indentifiers.
Skipping dissectors dir for now.

Change-Id: I717b66bfbc7cc81b83f8c2cbc011fcad643796aa
Reviewed-on: https://code.wireshark.org/review/25694
Petri-Dish: Dario Lombardo <lomato@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-02-08 19:29:45 +00:00
Peter Wu 98558fd81c Fix buffer overrun in try_bytesprefix_to_str
bytes_string list contains a list of prefixes to match, not the other
way round (matching prefixes in the list).

Bug: 13479
Change-Id: Ie625dc5db30bd55158d688a0101f35d0bf6906af
Fixes: v2.3.0rc0-2644-g540b555729 ("Introduce "bytes_string" type, similar to "value_string"")
Reviewed-on: https://code.wireshark.org/review/20532
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-03-13 21:46:38 +00:00
Peter Wu 540b555729 Introduce "bytes_string" type, similar to "value_string"
In order to map arbitrary byte buffers to strings, introduce a new
"bytes_string" type. Since "bytes_to_str" is already used for other
purposes, name the generic function "bytesval_to_str" instead similar to
the name( "val_to_str").

Accept "size_t" as length parameter since this is what is returned by
the "sizeof" operator. Do not add a "try_bytesval_to_str_idx" variant
since this pattern is not needed for now. Add a variant to match the
prefix since this is currently expected by the ISAKMP dissector.

Change-Id: I6d790325e85d9fb1384330f28a8c36e2057fdf30
Reviewed-on: https://code.wireshark.org/review/20386
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2017-03-08 23:04:12 +00:00
Michael Mann 600eca15fe Allow up to 64-bit values to use BASE_RANGE_STRING.
Change-Id: Iea69b5ef533b9b524a624b96bf82e178fd428ce9
Reviewed-on: https://code.wireshark.org/review/16934
Reviewed-by: Michael Mann <mmann78@netscape.net>
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2016-08-07 07:39:12 +00:00
João Valverde 94c0f91085 Fix value_string_ext_free() constness
Don't declare destructor as taking a const argument.

Change-Id: I9badfe400718bef41a0e0a00d4b3d1b0bb2879d1
Reviewed-on: https://code.wireshark.org/review/16342
Reviewed-by: João Valverde <j@v6e.pt>
Petri-Dish: João Valverde <j@v6e.pt>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-07-08 20:01:02 +00:00
Michael Mann b635997624 Convert val_to_str_ext -> val_to_str_ext_wmem for calls that don't have valid packet scope (GUI).
val_to_str_ext now officially uses wmem_packet_scope().

Removed const from val_to_str[_ext]_wmem return value since it's not really constant.

Created utility functions in qt_ui_utils.h to help with the new memory management for its GUI.

Change-Id: Idf2ce4a4ce78d628b2269ad23a3a48fbfc9c077c
Reviewed-on: https://code.wireshark.org/review/6926
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-02-03 13:03:32 +00:00
Michael Mann 6db0a358ea Create wmem versions of val_to_str and val_to_str_ext
These will be used to replace cases where packet-scope isn't valid for val_to_str/val_to_str_ext calls

Change-Id: Ie8a4c423a8608548c837c1ae7edde52c4d728340
Reviewed-on: https://code.wireshark.org/review/6880
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-02-02 12:56:32 +00:00
Kevin Cox 34e413f66d Make value_string_ext const-correct.
There is still some const-incorrect usage of them but those can be ironed
out after this change has been made.

Change-Id: Iba0631c804bdab34d7c0232b49967130e3370488
Reviewed-on: https://code.wireshark.org/review/3199
Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2014-07-27 22:02:42 +00:00
Peter Wu f2b4daf400 Add printf-format annotations, fix garbage
The WRETH dissector showed up some garbage in the column display. Upon
further inspection, it turns out that the format string had a trailing
percent sign which caused (unsigned)-1 to be returned by
g_printf_string_upper_bound (in emem_strdup_vprintf). Then ep_alloc is
called with (unsigned)-1 + 1 = 0 memory, no wonder that garbage shows
up. ASAN could not even catch this error because EP is in charge of
this.

So, start adding G_GNUC_PRINTF annotations in each header that uses
the "fmt" or "format" paramters (grepped + awk). This revealed some
other errors. The NCP2222 dissector was missing a format string (not
a security vuln though).

Many dissectors used val_to_str with a constant (but empty) string,
these have been replaced by val_to_str_const. ASN.1 dissectors
were regenerated for this.

Minor: the mate plugin used "%X" instead of "%p" for a pointer type.

The ncp2222 dissector and wimax plugin gained modelines.

Change-Id: I7f3f6a3136116f9b251719830a39a7b21646f622
Reviewed-on: https://code.wireshark.org/review/2881
Reviewed-by: Evan Huus <eapache@gmail.com>
2014-07-06 23:00:40 +00:00
Bill Meier 55d5c0f01b Add a hack to _VS_ENUM_XXX to prevent gcc "warning: comma at end of enumerator list [-pedantic]"
Change-Id: Icfab3cf8e152a2ee239c042e5bfbd9260d102035
Reviewed-on: https://code.wireshark.org/review/1194
Reviewed-by: Bill Meier <wmeier@newsguy.com>
Tested-by: Bill Meier <wmeier@newsguy.com>
2014-04-18 03:20:52 +00:00
Guy Harris c531099875 Try to fix bug 10000.
This involves duplicating macros, but at least it

	1) doesn't have empty arguments to macros, which are apparently
	   considered "undefined" by C90 and C++98

and

	2) doesn't involve "extern" applied to a definition rather than
	   a declaration, which breaks building on some platforms (and
	   which I think is also not legal C).

Change-Id: I7eb98963a6d2e1bc9f869ebce3d7ba9228b6c9e4
Reviewed-on: https://code.wireshark.org/review/1188
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-04-17 20:10:27 +00:00
Bill Meier 544f89eb9a Fix a [pedantic] gcc warning: "empty macro arguments are undefined in ISO C90 and ISO C++98"
Change-Id: I09f05bb1af1da20eb1a0675ed56fbe7e6b769d68
Reviewed-on: https://code.wireshark.org/review/1180
Reviewed-by: Bill Meier <wmeier@newsguy.com>
Tested-by: Bill Meier <wmeier@newsguy.com>
2014-04-17 02:05:57 +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
Bill Meier 11b5c15fdb Remove trailing whitespace
Change-Id: I8116f63ff88687c8db3fd6e8e23b22ab2f759af0
Reviewed-on: https://code.wireshark.org/review/385
Reviewed-by: Bill Meier <wmeier@newsguy.com>
Tested-by: Bill Meier <wmeier@newsguy.com>
2014-02-25 20:46:49 +00:00
Bill Meier 099efcf5eb Value_string.h: Minor changes to comment text
value_string.c:  value_string_ext_validate() always fails on Windows
                   when called from a different DLL (i.e. a plugin).
                   So: Add #ifndef _WIN32 around the offending code.

svn path=/trunk/; revision=54047
2013-12-13 14:39:19 +00:00
Irene Rüngeler 796bf409b0 Add dialogs and graphs to analyse SCTP behavior similar to the GTK version.
svn path=/trunk/; revision=54026
2013-12-13 07:25:30 +00:00
Jakub Zawadzki 4af107edfe Make VALUE_STRING_EXT_INIT use G_N_ELEMENTS macro instead of array_length.
array_length() requires including packet.h

svn path=/trunk/; revision=53851
2013-12-08 12:34:56 +00:00
Bill Meier 82f7344f45 Add some "helper" macros to:
Provide the capability to define a list of value_strings once and
     then to expand the list as an enum and/or as a value_string array.


svn path=/trunk/; revision=53487
2013-11-21 19:11:47 +00:00
Bill Meier 7727623d8c Do some constification;
Create/use value_string_ext_free();
Display certain numbers also as hex in the
   "forced to fall back to linear search: ..." value-string warning msg
Add editor-modelines to some files;
Do some whitespace changes.

svn path=/trunk/; revision=53484
2013-11-21 18:46:40 +00:00
Evan Huus c1dd5d3882 Replace some val_to_str calls with the equivalent val_to_str_const calls (and
implement rval_to_str_const to do this). The format-strings didn't have any
parameter specifiers in them, so they were clearly never used (or they would
have blown up) but still a bug.

This is one of the first steps towards converting val_to_str and friends to
wmem. I'm honestly not sure what the best approach is for the API in this case:
the vast majority of usage is within dissectors, so just hard-coding packet
scope (the way they currently hard-code ep_ scope) doesn't look terrible, but
there are *some* uses in taps and other places that will need to be converted to
something else if we go that route. Adding a wmem_pool parameter just for the
uncommon case seems a bit like overkill, though perhaps it is the right thing to
do.

svn path=/trunk/; revision=52264
2013-09-29 12:44:50 +00:00
Evan Huus 6e3a30794e Add 64-bit value strings and the appropriate tooling (including yet another
overloaded use of the DISPLAY field). Thanks to Jakub for pointing out I'd done
this wrong the first time (months ago in r49357).

Fixes severity display for collectd protocol, originally filed at:
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8472

svn path=/trunk/; revision=50935
2013-07-26 21:51:39 +00:00
Evan Huus d155b0da19 Implement str_to_val, opposite of val_to_str for value_strings.
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8467

svn path=/trunk/; revision=48645
2013-03-29 23:23:28 +00:00
Evan Huus a0d107beec Remove decode_enumerated_bitfield and decode_enumerated_bitfield_shifted.
Effectively inline the only remain call (and replace a static buffer with ep
memory). Much of the NFS dissector needs to be converted to use named fields
at which point this code can go away, but that's a much bigger job.

Also, add modelines to packet-nfs.c and mark some internal value_string
functions as WS_DLL_LOCAL.

svn path=/trunk/; revision=48635
2013-03-29 02:34:23 +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
Balint Reczey 1ebdb2e521 Export libwireshark symbols using WS_DLL_PUBLIC define
Also remove old WS_VAR_IMPORT define and related Makefile magic
everywhere in the project.

svn path=/trunk/; revision=47992
2013-03-01 23:53:11 +00:00
Guy Harris 8ed7a73e22 Fix a bunch of warnings.
Cast away some implicit 64-bit-to-32-bit conversion errors due to use of
sizeof.

Cast away some implicit 64-bit-to-32-bit conversion errors due to use of
strtol() and strtoul().

Change some data types to avoid those implicit conversion warnings.

When assigning a constant to a float, make sure the constant isn't a
double, by appending "f" to the constant.

Constify a bunch of variables, parameters, and return values to
eliminate warnings due to strings being given const qualifiers.  Cast
away those warnings in some cases where an API we don't control forces
us to do so.

Enable a bunch of additional warnings by default.  Note why at least
some of the other warnings aren't enabled.

randpkt.c and text2pcap.c are used to build programs, so they don't need
to be in EXTRA_DIST.

If the user specifies --enable-warnings-as-errors, add -Werror *even if
the user specified --enable-extra-gcc-flags; assume they know what
they're doing and are willing to have the compile fail due to the extra
GCC warnings being treated as errors.

svn path=/trunk/; revision=46748
2012-12-26 05:57:06 +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 6e272a624a (Trivial) fix a spelling error.
svn path=/trunk/; revision=37126
2011-05-13 15:39:43 +00:00
Jakub Zawadzki 1ea1e9fef2 Change value_string_ext->_vs_match to return value_string struct (instead of strptr),
Now index can be easily calculated so remove idx pointer from all match functions.

Just in case change names if someone is using wireshark internals.

svn path=/trunk/; revision=36930
2011-04-28 11:15:46 +00:00
Jeff Morriss 45920c1e15 Fix the fuzz failure in https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=5574 :
The first time a value_string_ext() is accessed, _match_strval_ext_init() is
used before the real match function is called.  This function was not expanded
to take an idx parameter (in rev 35451).  It compiled only because the function:
  a) previously did not match _value_string_match_t
  b) and the difference was being cast away when assigning _match_strval to it
     (So the fact that the index parameter was not added was also ignored.)

To fix the problem, give _match_strval_ext_init() and index parameter and use
it instead of a dummy variable when calling the real match function.  That way
the first call to match_strval_ext_idx() will return an actual (initialized)
index.

To prevent the problem in the future, make the vse argument to
_match_strval_ext_init() const *and then cast away the constness* so the
function can modify the vse.

svn path=/trunk/; revision=35508
2011-01-12 17:20:52 +00:00
Anders Broman 6404b4437a Introduce match_strval_idx_ext()
svn path=/trunk/; revision=35451
2011-01-10 14:31:33 +00:00
Bill Meier a7063f9cc8 'tshark -G values' - Validate (somewhat) value_string_ext before use to prevent a crash.
svn path=/trunk/; revision=34869
2010-11-14 16:30:56 +00:00
Bill Meier cfdd78166f Enhance 'tshark -G values': Add info about extended value strings (including acess method).
svn path=/trunk/; revision=34854
2010-11-12 19:48:30 +00:00
Bill Meier 15851701e8 Rework "extended value strings":
- Allow direct access when a range of values begins with a value other than 0;
- Provide value_string_ext_new() for creating extended value strings at runtime;
- Do access to value_string_ext members via a macro (all but value_string.c);
- Update documentation.

svn path=/trunk/; revision=34514
2010-10-14 17:50:35 +00:00
Jaap Keuter 8b3728ef01 Correct two comments.
svn path=/trunk/; revision=32578
2010-04-27 16:18:06 +00:00
Anders Broman ab825ec9d9 From Jakub Zawadzki:
- use function pointers instead of switch.
 - initalize ->match_type during first use of match_str() func.

svn path=/trunk/; revision=32576
2010-04-27 12:38:49 +00:00
Anders Broman fab55e4772 From Jakub Zawadzki:
Itroduce value_string_ext for faster value matching in value_strings.

svn path=/trunk/; revision=32574
2010-04-27 10:32:34 +00:00
Bill Meier 6812b68eb1 From Yaniv Kaul: constify parameters
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=4422

 From me: Fix a number of instances where the function prototype or
  the function definition wasn't changed so there was a mismatch 
  thus causing Windows (but not gcc) compilation errors.

svn path=/trunk/; revision=32365
2010-04-03 18:18:50 +00:00
Bill Meier d32b4c0758 Revert SVN #32360 until Windows compilation errors corrected.
svn path=/trunk/; revision=32361
2010-04-02 15:18:03 +00:00
Bill Meier 049f9eac85 From Yaniv Kaul: constify parameters
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=4422

svn path=/trunk/; revision=32360
2010-04-02 14:37:49 +00:00