Commit Graph

86 Commits

Author SHA1 Message Date
Michael Mann ee208c8dcc Add support for RELATIVE-OID ASN.1 type. Bug 9192 (https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9192)
From Ed Beroset.

svn path=/trunk/; revision=52393
2013-10-06 02:31:10 +00:00
Bill Meier 828d4e89f6 Define certain 'const char *...' arrays as static.
(That is: Don't create the array on the stack each time
  the function is called).

 Reduces code memory usage and execution time.
 (See SVN #50271)


svn path=/trunk/; revision=50300
2013-07-01 15:41:05 +00:00
Gerald Combs c0702583d3 Make the minimum supported GLib version 2.16.
svn path=/trunk/; revision=49444
2013-05-20 17:27:05 +00:00
Anders Broman 55c498169d From beroset:
remove C++ incompatibilities 
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8416

svn path=/trunk/; revision=48400
2013-03-18 21:16:23 +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
Martin Kaiser 3eb2a8644f trivial: clean up epan/strutil.c
replace TABs with spaces
   add editor modelines

svn path=/trunk/; revision=46706
2012-12-22 23:27:40 +00:00
Anders Broman e9f13d771c g_strcmp0 first occures in GLIB 2.16 define it localy if it does not exist
to make builds on Fedora 8 with GTK 2.12 work.

svn path=/trunk/; revision=45707
2012-10-22 12:20:36 +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
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
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
Jakub Zawadzki 42ec0ca701 Revert r35131 fix bug #5738
g_unichar_isprint() is for *wide characters*.
For UTF-8 multibyte characters we could 
use g_utf8_validate() and g_utf8_next_char(),
but IMHO format_text_* should be ASCII-only.

We rather need to store encoding of FT_STRING[Z]
and in proto_item_fill_label() call appropiate
function.
For ENC_ASCII use format_text(),
for unicode (ENC_UTF*, ENC_UCS*) use format_text_utf(),
etc..

svn path=/trunk/; revision=42727
2012-05-20 18:32:44 +00:00
Anders Broman fc41d4ad51 From Evan Huus:
Duplicate and misplaced 'break' statements.

https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=7106

svn path=/trunk/; revision=42091
2012-04-16 08:39:34 +00:00
Jakub Zawadzki 23494db817 Add missing const attribute to some char *
Fix some "assignment discards qualifiers from pointer target type", etc

svn path=/trunk/; revision=41996
2012-04-09 18:44:10 +00:00
Guy Harris 4447b23f6b Squelch some compiler warnings.
svn path=/trunk/; revision=37685
2011-06-16 18:34:17 +00:00
Stephen Fisher 9246c41703 Change ws_strdup_escape_underscore() function to be more general, by
accepting any character as the escaped character.  Change existing
uses to use '_' for the underscore escaping.


svn path=/trunk/; revision=36627
2011-04-13 16:56:24 +00:00
Gerald Combs a6bbdaa849 Fix some dead code and zero division issues found by Clang scan-build.
In convert_string_case() use g_utf8_strup() instead of converting each
character by hand. Hopefully this won't cause any unexpected changes in
behavior.

svn path=/trunk/; revision=36006
2011-02-18 22:43:48 +00:00
Stephen Fisher 4b27022ac7 Change format_text() and format_text_wsp() to use g_unichar_isprint() for
UTF-8 support instead of isprint().  This allows the middle packet details
pane to display UTF-8 strings instead of escaping them with \xxx notation.


svn path=/trunk/; revision=35131
2010-12-06 18:30:39 +00:00
Stig Bjørlykke 0b3ed37b63 Corrected some pointer types to avoid warnings from clang.
svn path=/trunk/; revision=34774
2010-11-04 11:26:20 +00:00
Jeff Morriss 05f5bf510b Use the top-level isprint.h instead of redefining isprint ourselves.
svn path=/trunk/; revision=34016
2010-08-30 15:33:32 +00:00
Gerald Combs fa5f6cced7 From Edgar Gladkich:
This is an extension to the Wireshark context sensitive protocol help. Rows in
TreeView window are analyzed and suitable help file (as HTML) is opened in a
browser.

The help part (large file, 23 MB) of the Protocol Help can be downloaded under
www.inacon.com/dowload/stuff/protocol_help.tar.gz

This protocol help "light" provides descriptive content for the most frequently
used standard protocols, including IP, TCP or SMTP.

From me:

Changes:

Rename "ph_" in some function names to "proto_help_". Move the protocol
help code to its own module.

Make a bunch of functions static. Remove unused code.

Use browser_open_url() instead of a custom function.

Increase the logging levels. Don't clobber the normal log handler.

Update some Doxygen comments to match the format in the rest of the code
base.

Removed GTK version checks. We've been 2.x only for a while.

Move ph_replace_string to string_replace() in epan/strutil.[ch].

Fix a bunch of memory leaks.

Add a NULL pointer check.

Reformat the overview menu label.

Document the file format and locations.

Add Edgar to AUTHORS.

svn path=/trunk/; revision=32995
2010-05-27 15:51:25 +00:00
Anders Broman 4e66c899d1 From Jakub Zawadzki:
Optimizations.
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=4303

svn path=/trunk/; revision=31967
2010-02-23 19:28:38 +00:00
Bill Meier 9d663d7081 Fix various gcc -Wshadow warnings.
svn path=/trunk/; revision=31720
2010-01-28 18:45:46 +00:00
Gerasimos Dimitriadis c08fa6f3cf Move underscore escaping/unscaping function to strutil.c;
Update decoding of IS-801 Request GPS Acquisition Assistance

svn path=/trunk/; revision=31685
2010-01-26 18:21:17 +00:00
Anders Broman f82442badc Move IA5_7BIT_decode to strutil.c
svn path=/trunk/; revision=30669
2009-10-23 01:56:09 +00:00
Stephen Fisher f9fb2a7d7a Remove comment asking if this function should be in strutil.c since it is
already there.


svn path=/trunk/; revision=30225
2009-10-01 02:09:30 +00:00
Anders Broman 7ec476b88a From Didier Gautheron:
Part 2
Extracted from optimizations patch http://wiki.wireshark.org/Development/Optimization
Optimize expert info.
Slightly changed by me.

svn path=/trunk/; revision=29478
2009-08-19 18:37:13 +00:00
Gerald Combs f0eeb0bdf1 More size_t fixes. Use a string buffer in range.c.
svn path=/trunk/; revision=27999
2009-04-08 16:50:20 +00:00
Gerald Combs 2c74073079 Add a couple of size_t casts to packet-dnp.c.
Make the length arguments of format_text() and format_text_wsp()
size_t's, since it's natural to use strlen() for that.

svn path=/trunk/; revision=27891
2009-03-30 03:40:12 +00:00
Gerald Combs 95ddd62076 Add a string utility function "string_or_null" which can be used to
guarantee a non-null string value. Use it in the LDAP dissector. Fixes
the crash on Windows (and other platforms) reported in bug 3262.

svn path=/trunk/; revision=27478
2009-02-17 23:15:35 +00:00
Stig Bjørlykke 657104a0db Small whitespace fix.
svn path=/trunk/; revision=25726
2008-07-12 19:28:24 +00:00
Jörg Mayer c62680b8eb Fix a tpyo
svn path=/trunk/; revision=25227
2008-05-05 00:39:47 +00:00
Anders Broman 63c5c71cf8 Remove:
#ifdef NEED_G_ASCII_STRCASECMP_H
#include "g_ascii_strcasecmp.h"
#endif

svn path=/trunk/; revision=24859
2008-04-09 05:36:08 +00:00
Stephen Fisher 726a1caaf1 - Remove GLIB1 code
- Change ugly GLIB version checking statements to GLIB_CHECK_VERSION
- Remove ws_strsplit files because we no longer need to borrow GLIB2's
  g_strsplit code for the no longer supported GLIB1 builds


svn path=/trunk/; revision=24829
2008-04-07 05:22:54 +00:00
Guy Harris 9c89cdaaa3 strcasecmp(), strncasecmp(), g_strcasecmp(), and g_strncasecmp() delenda
est.  Use g_ascii_strcasecmp() and g_ascii_strncasecmp(), and supply our
own versions if they're missing from GLib (as is the case with GLib
1.x).

In the code to build the list of named fields for Diameter, don't use
g_strdown(); do our own g_ascii_-style upper-case to lower-case mapping
in the hash function and use g_ascii_strcasecmp() in the compare
function.

We do this because there is no guarantee that toupper(), tolower(), and
functions that use them will, for example, map between "I" and "i" in
all locales; in Turkish locales, for example, there are, in both
upper case and lower case, versions of "i" with and without a dot, and
the upper-case version of "i" is "I"-with-a-dot and the lower-case
version of "I" is "i"-without-a-dot.  This causes strings that should
match not to match.

This finishes fixing bug 2010 - an earlier checkin prevented the crash
(as there are other ways to produce the same crash, e.g. a bogus
dictionary.xml file), but didn't fix the case-insensitive string matching.

svn path=/trunk/; revision=23623
2007-11-27 18:52:51 +00:00
Ronnie Sahlberg 7885237398 add a g_byte_array_sized_new() helper if we compile for glib < 2
svn path=/trunk/; revision=23373
2007-11-06 05:51:49 +00:00
Anders Broman 1143ab41b1 Apply yet another set of the optimization patches:
- Use a fast path for the most common use of tvb_get_xxx functions:
offset is >= 0 and tvb->real_data is set (this one is always true).
- match_strval() is a linear search, put the most common protocols
TCP/UDP/RDP first.
- fix gtk1 g_strlcat declaration Use g_strlcat

svn path=/trunk/; revision=23285
2007-10-27 14:44:29 +00:00
Anders Broman 3a16fb20a3 Apply yet another set of the optimization patches:
Replace strncpy with g_strlcpy.
Add g_strlcat for GTK1 and don't use g_snprintf in GTK1 g_strlcpy
printf family is very slow.

svn path=/trunk/; revision=23273
2007-10-26 05:42:12 +00:00
Guy Harris fad7133f81 Fix yet more casts of ctype.h macro arguments - and fix some cases where
we were passing an uncasted "char" to those macros.

svn path=/trunk/; revision=22306
2007-07-14 00:37:01 +00:00
Gerald Combs 249a747c51 Be less restrictive about WEP key preferences. Use hex_str_to_bytes to
process WEP keys.  Allow the "wep:" prefix for WEP keys even when
HAVE_AIRPDCAP isn't defined.  Add a NULL pointer check to
hex_str_to_bytes().  Fixes bug 1584.

Fixup indentation.

svn path=/trunk/; revision=22151
2007-06-21 17:49:03 +00:00
Ronnie Sahlberg c1040f6c5d make gtk1 compile again
svn path=/trunk/; revision=21854
2007-05-21 02:38:19 +00:00
Stephen Fisher fa57c8fc44 Fix some Solaris buildbot warnings
svn path=/trunk/; revision=21423
2007-04-13 23:32:21 +00:00
Luis Ontanon 92fd73681d From: Gisle Vanem
The file epan/dissectors/packet-k12.c uses the function
strcasestr() which is not available on e.g. Windows. So I cooked
up a patch to epan/strutil.c to add epan_strcasestr() (is there a more
suited place for such a function?)





svn path=/trunk/; revision=20734
2007-02-07 13:45:28 +00:00
Stephen Fisher c12d1c7c5b From Sebastien Tandel:
Steve has modified a while ago hex_str_to_bytes to handle Cisco MAC
format (xxxx.xxxx.xxxx). It did not test the nullity of the third and
fourth byte (*r, *s) which is however done for the second byte. The test
on the second byte is done as well in the following conditional tests.
If this test is not mandatory thanks to the return value of isxdigit (at
least on GNU/Linux and guess it should be the same on any platform), it
would be better to follow the same logic in all tests cases for the
comprehension of everyone (... which /could/ even, with luck, be turned
in a faster code).
Here is a light patch to follow the logic of the conditional tests done
in the function.


svn path=/trunk/; revision=20714
2007-02-04 19:23:10 +00:00
Stephen Fisher d253c37814 Allow byte strings (FT_BYTES) to have four digits seperated by - : and .
in addition to the currently supported two or one digit at a time.  This
applies in particular to the FT_ETHER MAC addresses, so that a MAC address
can now be entered as xxxx.xxxx.xxxx in addition to the traditional formats.


svn path=/trunk/; revision=20660
2007-02-01 01:37:34 +00:00
Gerald Combs 2664012ca6 Fix a key preference crash bug. Improve WPA passphrase and SSID length
handling.  Free a byte array.  Squelch a compiler warning.  Fix a URI
string parsing bug.

svn path=/trunk/; revision=20549
2007-01-25 01:24:14 +00:00
Gerald Combs d48fdc7375 GLib 1.2 doesn't have g_strlcpy(), so don't use it.
svn path=/trunk/; revision=20438
2007-01-15 07:29:13 +00:00
Gerald Combs def1f435fc Fix compilation problems under Windows. In the GTK code, convert SSIDs
to GByteArrays.  Add format_uri() to strutil, which formats a byte string
with percent-escapes.  Fixup whitespace and indentation.

svn path=/trunk/; revision=20397
2007-01-11 22:12:33 +00:00
Gerald Combs 983f496f69 Add uri_str_to_bytes(), byte_array_dup(), and byte_array_equal()
functions to strutil.  Use GByteArrays to store SSIDs for decryption,
and let the user specify arbitrary byte strings using percent-encoded
strings.  We should probably add percent encoding for pass phrases as
well, so you can escape the ":" character.

Move the key struct key conversion utilities to airpdcap.c, and remove
duplicate code from packet-ieee80211.c.  Fix a lot of indentation.

svn path=/trunk/; revision=20388
2007-01-11 02:42:34 +00:00
Gerald Combs fc62f98e74 In the 802.11 dissector, mark the "wep_keys" preference as obsolete,
and replace it with an "enable_decryption" preference.

Instead of forcing the user to specify how many WEP keys we have,
figure it out for ourselves by parsing the key list.  When decrypting,
don't worry about the key index specified in the header (which resulted
in trying to decrypt using the same key twice); simply try each key in
order (which we were doing anyway).

In hex_str_to_bytes(), handle a null hex string.

Update the release notes.

svn path=/trunk/; revision=19592
2006-10-18 17:55:29 +00:00
Gerald Combs 9e23f31e5f Add support for reading from stdin under Windows. Based on a patch sent
in last year by Gianluca Varenni.

Add partial support for reading from named pipes (currently disabled).

Move utf_8to16() and utf_16to8() to a separate module (unicode-utils.[ch])
so that we don't have to cut and paste code in dumpcap.c.

Fix up whitespace.

svn path=/trunk/; revision=19291
2006-09-22 21:14:54 +00:00