Commit Graph

83 Commits

Author SHA1 Message Date
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 e21ca35116 Improve g_warning text slightly.
svn path=/trunk/; revision=34697
2010-10-29 22:01:29 +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
Bill Meier 7219ee2a49 Use val_to_str_ext() & friends to access sminmpec_values[];
Also: packet-nhrp.c: #include sminmpec.h not req'd;

svn path=/trunk/; revision=34143
2010-09-17 04:51:21 +00:00
Gerasimos Dimitriadis df3a43e0e5 Remove debugging printf from match_strval_ext_init()
svn path=/trunk/; revision=32903
2010-05-19 22:09:07 +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
Kovarththanan Rajaratnam 6fe1060cd1 Don't pass ep_alloc()'ed strings to col_set_str().
Fixes https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=3984

svn path=/trunk/; revision=29726
2009-09-06 04:26:50 +00:00
Gerald Combs 8a6daf2a1c From Didier Gautheron via bug 3052:
Add:
- FIX 4.0 to 4.4 fields, auto generated with XSLT stylesheets applied on
http://www.quickfixengine.org/ xml files (not included quickfixengine code is
BSD but xml files have no copyright).

- value_string functions for string keys, added to value_string.c.

- FIX desegmentation, it doesn't work well with malformed FIX PDU.

svn path=/trunk/; revision=28478
2009-05-26 00:49:38 +00:00
Gerald Combs c2ae798ae2 More size_t fixes.
svn path=/trunk/; revision=28000
2009-04-08 17:31:12 +00:00
Jaap Keuter c1484a08df Allow for dynamic value string array selection.
svn path=/trunk/; revision=23149
2007-10-11 19:40:58 +00:00
Stephen Fisher c980cede98 From Francesco Fondelli:
I defined a range_string struct. It's like value_string
but stores range <-> string pairs.
Moreover I wrote rval_to_str(), match_strrval_idx()
match_strrval() which are behaving exactly as
val_to_str(), match_strval_idx() and match_strval().


svn path=/trunk/; revision=20061
2006-12-07 20:29:40 +00:00
Ronnie Sahlberg 89f022b12b name change
svn path=/trunk/; revision=18197
2006-05-21 05:12:17 +00:00
Guy Harris 995aa3f43b Get rid of a no-longer-used variable.
svn path=/trunk/; revision=15816
2005-09-15 09:09:00 +00:00
Guy Harris 1bac10d41d Use ep_strdup_printf() to generate the "not found in value_string table"
string for val_to_str().

svn path=/trunk/; revision=15814
2005-09-15 08:55:43 +00:00
Ronnie Sahlberg a34e7e3d03 removal of even more sprintf
svn path=/trunk/; revision=15457
2005-08-20 02:33:33 +00:00
Ronnie Sahlberg 19e3bae487 fix some more silly rotating buffers
svn path=/trunk/; revision=15385
2005-08-17 09:28:24 +00:00
Ulf Lamping 0dc9fb3d4a various code cleanup:
-use g_snprintf instead of sprintf and snprintf
-use g_strdup_printf where appropriate
-remove #include "snprintf.h" (as only g_snprintf should be used)
-replace some more alloc/realloc/calloc/free with their glib pendants

svn path=/trunk/; revision=15264
2005-08-08 18:50:39 +00:00
Guy Harris ab797734dd Get rid of the private "my_match_strval()" routine in many dissectors;
add a "match_strval_idx()" routine that does the same thing, and have
"match_strval()" call it.

Make those routines, and "val_to_str()", return a "const" pointer. 
Update dissectors as necessary to squelch compiler warnings produced by
that.

Use "val_to_str()" rather than using "match_strval()" and then, if the
result is null, substituting a specific string.  Clean up some other
"match_strval()"/"val_to_str()" usages.

Add a null pointer check in the NDPS dissector's "attribute_value()"
routine, as it's not clear that "global_attribute_name" won't be null at
that point.

Make some global variables in the AFS4INT dissector local.

Make some routines not used outside the module they're in static.

Make some tables "static const".

Clean up white space.

Fix Gerald's address in some files.

svn path=/trunk/; revision=14786
2005-06-26 19:56:52 +00:00
Ulf Lamping 6c3b559e21 value_string.c(71) : warning C4090: 'return' : different 'const' qualifiers
svn path=/trunk/; revision=14784
2005-06-26 11:40:26 +00:00
Gerald Combs 7a412fadf3 Force the "fmt" argument of val_to_str() to be non-null. Change the 9P
dissector to use a non-null format.  Fixes bug 70.

Fix the line endings in the 9P dissector, and set its SVN properties.

svn path=/trunk/; revision=14127
2005-04-18 16:16:57 +00:00
Guy Harris 8a8b883450 Set the svn:eol-style property on all text files to "native", so that
they have LF at the end of the line on UN*X and CR/LF on Windows;
hopefully this means that if a CR/LF version is checked in on Windows,
the CRs will be stripped so that they show up only when checked out on
Windows, not on UN*X.

svn path=/trunk/; revision=11400
2004-07-18 00:24:25 +00:00
Guy Harris f549d46c37 From Tomas Kukosa: add "decode_enumerated_bitfield_shifted()", which is
like "decode_enumerated_bitfield()" but handles value_string tables
containing values as they appear in the bitfield rather than as they
appear in the item containing the bitfield.

svn path=/trunk/; revision=9134
2003-12-01 23:42:32 +00:00
Jörg Mayer 48be4e530d Removed trailing whitespaces from .h and .c files using the
winapi_cleanup tool written by Patrik Stridvall for the wine
project.

svn path=/trunk/; revision=6116
2002-08-28 20:41:00 +00:00
Guy Harris 07c2ce1bad Get rid of no-longer-necessary includes of <sys/time.h>.
svn path=/trunk/; revision=3936
2001-09-14 07:23:34 +00:00
Guy Harris 13681cf12b Include <sys/time.h> as well as <time.h> in "column-utils.c" and
"value_string.c", as they include "epan/to_str.h", and that uses "struct
timeval" in some function prototypes.

In "to_str.c", include <sys/types.h> before including <netinet/in.h>; on
at least some platforms, definitions in <netinet/in.h> require types
defined in <sys/types.h>.

In "to_str.c", include <sys/socket.h>, so that AF_INET6 is defined.

svn path=/trunk/; revision=3238
2001-04-02 02:30:06 +00:00
Ed Warnicke c832ac2c35 Moved the value_string structures and function from packet.{c,h} into
a separate value_string.{c,h}.

svn path=/trunk/; revision=3221
2001-04-01 03:18:41 +00:00