Commit Graph

142 Commits

Author SHA1 Message Date
Anders Broman 84241f46ad From beroset:
remove C++ incompatibilities 
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8416

svn path=/trunk/; revision=48399
2013-03-18 20:44:36 +00:00
Guy Harris 6b629c4d92 Move show_exception() and show_reported_bounds_error() to
epan/show_exception.c, as it's used outside
epan/dissectors/packet-frame.c.  Update their callers to include
<epan/show_exception.h> to get their declaration.

Add a CATCH_NONFATAL_ERRORS macro that catches all exceptions that, if
there's more stuff in the packet to dissect after the dissector call
that threw the exception, doesn't mean you shouldn't go ahead and
dissect that stuff.  Use it in all those cases, including ones where
BoundsError was inappropriately being caught (you want those passed up
to the top level, so that the packet is reported as having been cut
short in the capture process).

Add a CATCH_BOUNDS_ERRORS macro that catches all exceptions that
correspond to running past the end of the data for a tvbuff; use it
rather than explicitly catching those exceptions individually, and
rather than just catching all exceptions (the only place that
DissectorError should be caught, for example, is at the top level, so
dissector bugs show up in the protocol tree).

Don't catch and then immediately rethrow exceptions without doing
anything else; just let the exceptions go up to the final catcher.

Use show_exception() to report non-fatal errors, rather than doing it
yourself.
 
If a dissector is called from Lua, catch all non-fatal errors and use
show_exception() to report them rather than catching only
ReportedBoundsError and adding a proto_malformed item.

Don't catch exceptions when constructing a trailer tvbuff in
packet-ieee8023.c - just construct it after the payload has been
dissected, and let whatever exceptions that throws be handled at the top
level.

Avoid some TRY/CATCH/ENDTRY cases by using checks such as
tvb_bytes_exist() before even looking in the tvbuff.

svn path=/trunk/; revision=47924
2013-02-27 22:43:54 +00:00
Guy Harris ef715a28ae For each dynamic-payload hash table, keep a Boolean indicating whether
it's been used in an rtp_set_address() or srtp_set_address() call and,
if that Boolean is set, don't free the hash table; this fixes a case
where the hash table was freed while it was in use.

svn path=/trunk/; revision=47740
2013-02-18 22:37:07 +00:00
Michael Mann 823493b927 Only allow one packet to act as an SDP response. This should probably be caught at a higher layer (SIP), but the safety net should be there.
Also, cleanup SIP "response error" range.

Fixes crash in bug 8343 (https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8343)

svn path=/trunk/; revision=47705
2013-02-17 18:25:22 +00:00
Michael Mann ad92b749e8 Fix crash with SDP setup mechanism, bug 8323 (https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8323)
The issue was that hash tables were being accessed after they were freed from a "rejected answer".  

The code was also too generous in considering many SIP status codes as "rejected answers", so now less SIP status codes are treated as "rejected answers" and are ignored by the transport API.


svn path=/trunk/; revision=47652
2013-02-14 03:30:32 +00:00
Michael Mann 222a190373 Fix Coverity 980630, negative array index read.
svn path=/trunk/; revision=47648
2013-02-13 01:49:06 +00:00
Michael Mann c752593698 Handle SIP "resends" within SDP. This is to handle "duplicate" OFFERs so they don't end up being handled by setup_sdp_transport() because the current frame couldn't match a request (due to duplication).
setup_sdp_transport_resend() should be unnecessary once all higher layers use setup_sdp_transport() and the "registration" code within dissect_sdp() is removed.

svn path=/trunk/; revision=47572
2013-02-08 17:52:12 +00:00
Evan Huus fc48d80b32 Use glib's isdigit function.
svn path=/trunk/; revision=47565
2013-02-08 14:03:33 +00:00
Michael Mann faf307e2fc Support SDP context over SIP.
Added setup_sdp_transport() to allow higher layer protocols to call SDP with context to correctly setup an OFFER/ANSWER within SDP (which doesn't have its own transport layer).  I attempted to keep backwards compatibility until all higher layer protocols set up OFFER/ANSWER context.  If OFFER/ANSWER (request/response) can't be found (which would be the case for higher layer protocols without context), Wireshark should resort to the old behavior of applying SDP information as it sees packets.

This patch includes integration with SIP as it appears to have the most bug reports.  Other higher layer protocols will be done later.  Most are mentioned in bug 2368.

Fixes bug 2368 (https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=2368) and all its duplicates
Fixes bug 2992 (https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=2992) and all its duplicates

svn path=/trunk/; revision=47564
2013-02-08 13:47:07 +00:00
Anders Broman 750c5a8401 Fix dissection of path ["/" session-id] is optional.
svn path=/trunk/; revision=47270
2013-01-25 09:08:24 +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
Anders Broman 52a4bd4644 Try to fix packet-sdp.c:1542: warning: 'parameter_item' may be used uninitialized in this function.
svn path=/trunk/; revision=46346
2012-12-03 15:04:24 +00:00
Anders Broman a07cfc3b50 Protect against malformed crypto-suite parameters.
Fixes SDP infinite loop.
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8041

svn path=/trunk/; revision=46344
2012-12-03 13:55:03 +00:00
Anders Broman 82e67826b4 Back out the SDP part of r46165 "Set up BFCP conversations".
svn path=/trunk/; revision=46201
2012-11-26 09:30:00 +00:00
Anders Broman dff339dd1e Set up BFCP conversations
svn path=/trunk/; revision=46165
2012-11-24 17:06:08 +00:00
Anders Broman cba1bb8278 As ths SDP dissector adds /SDP to the protocol column I think that
col_append_str(pinfo->cinfo, COL_INFO, ", with session description"); is redundant if some one has a different opinion fel free to revert.

svn path=/trunk/; revision=45428
2012-10-09 15:00:39 +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
Anders Broman d3334cb21d Handle SDP_CRYPTO optional parameters better.
svn path=/trunk/; revision=44946
2012-09-17 15:37:28 +00:00
Michael Mann 6c0e747f61 use session allocated memory for rtp_add_address/srtp_add_address hash tables
svn path=/trunk/; revision=44571
2012-08-19 00:21:26 +00:00
Jeff Morriss b63d63529c Fix fuzz failure reported in https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=7560 :
Don't assume that we stored off the SPRT conversation port.  This was code
comes from r43887/bug 3507 so no need to backport.

svn path=/trunk/; revision=44243
2012-08-03 13:55:07 +00:00
Michael Mann 0d4eafb04d Update display filter names per Bug 2794. Part 1 of many.
svn path=/trunk/; revision=43907
2012-07-22 03:06:37 +00:00
Bill Meier 45f9935f04 Additional cleanup:
packet-sdp.c:
  Init 'proto_sprt' in proto_reg_handof..()
    [instead of using a registered init fcn];

packet-sprt.c:
  Fix some typos;
  Comment out dissect_sprt_heur() since it doesn't
   really do any dissection. Add an XXX comment re same.

packet-v150fw.c:
  Remove unused 'v150fw_handle' and thus unneeded proto_reg_handoff...();
  Add an XXX comment re the (commented out) dissect_v150fw() not actually
   doing any dissection.


svn path=/trunk/; revision=43902
2012-07-21 22:06:17 +00:00
Evan Huus f9ec58ae1d Because storing the address of a stack variable seemed like such
a good idea at the time...

Allocate seasonal memory for it instead.

svn path=/trunk/; revision=43896
2012-07-21 15:31:35 +00:00
Evan Huus 897d72c358 Fix some of the GCC build errors, more to come.
svn path=/trunk/; revision=43889
2012-07-21 13:25:14 +00:00
Michael Mann 3d502b97f1 Updated patch from https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=3507
svn path=/trunk/; revision=43887
2012-07-21 12:38:59 +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 f9a08c84d5 General cleanup:
- whitespace;
- formatting (including long lines & hf[] entries).

svn path=/trunk/; revision=42614
2012-05-13 14:53:26 +00:00
Bill Meier 07d88fc044 From Evan Huus:
In dissect_sdp_media_attribute() we can leak 'key' in an error condition.
 Simply move the allocation to after the error check.

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

svn path=/trunk/; revision=42456
2012-05-07 01:18:17 +00:00
Jakub Zawadzki 68ec58d385 Fix some: 'cast discards qualifiers from pointer target type' warnings
- Add const qualifier
- Remove some strange casts

svn path=/trunk/; revision=42131
2012-04-18 12:35:36 +00:00
Alexis La Goutte 846fe21e31 Fix some Dead Store (Dead assignement/Dead increment) Warning found by Clang
svn path=/trunk/; revision=40903
2012-02-06 22:15:24 +00:00
Anders Broman c1813b0701 Collect and use some SRTP information.
svn path=/trunk/; revision=40794
2012-02-01 20:33:33 +00:00
Jeff Morriss f091005d3e Fix infinite loop reported in https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=6778 :
SDP_CRYPTO: Give up (and display an expert info) if we don't find the colon
separating the key-method and the key-info.

Reindent this area of code a bit.

Remove tabs in some places for consistency.

svn path=/trunk/; revision=40771
2012-01-30 17:39:15 +00:00
Anders Broman 63e6945482 Dissect the crypto attribute.
svn path=/trunk/; revision=40732
2012-01-26 17:52:13 +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
Martin Mathieson c3d27315ed Avoid longjmp warning by making adding volatile.
svn path=/trunk/; revision=39364
2011-10-11 18:06:01 +00:00
Anders Broman eeff694c87 - Put a TRY/CATCH block around dissect_h264_nal_unit() in case
a bogus nal unit was sent.
- Delete an unused hf entry.

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

svn path=/trunk/; revision=39305
2011-10-07 16:42:52 +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
Bill Meier d2269ce7d5 Fix gcc 4.6 "set but not used [-Wunused-but-set-variable]" warnings.
svn path=/trunk/; revision=37716
2011-06-19 18:47:35 +00:00
Bill Meier a2b58f051d Add #include <stdlib.h> to files which reference fcns declared in stdlib.h;
(In many cases I previously incorrectly removed the #include <stdlib.h>).

svn path=/trunk/; revision=37334
2011-05-20 19:00:09 +00:00
Stephen Fisher ef5823c210 Put back in one of the includes removed in r36606: ctype.h for isdigit()
function.


svn path=/trunk/; revision=36607
2011-04-12 20:29:42 +00:00
Bill Meier c85689f108 Don't assign to a proto_item * if the value won't be used: Coverity 1034;
Comment out two calls to tvb_)get_ephemeral_string since the result is never used: Coverity 1035;
Also:
 Remove some unneeded #includes;
 Use consistent indentation.

svn path=/trunk/; revision=36606
2011-04-12 20:19:10 +00:00
Martin Mathieson 473b578880 Remove static that was added to appease Coverity 753. 2016 bytes isn't too much to put on the stack.
svn path=/trunk/; revision=36285
2011-03-23 10:12:35 +00:00
Martin Mathieson 034820599a Make a struct static to avoid growing the stack too much.
Coverity CID 753.

svn path=/trunk/; revision=36255
2011-03-22 17:46:59 +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
Anders Broman cab0cef11d Use value_string_ext for RTP payload types.
svn path=/trunk/; revision=34804
2010-11-08 14:43:59 +00:00
Jaap Keuter 12b574e628 Fix for bug 5220:
- Don't list codecs which are deleted by using port 0.
- Use real concatenation i.s.o. reprint, which seems to fail in some circumstances.

svn path=/trunk/; revision=34154
2010-09-18 13:12:03 +00:00
Anders Broman b1568cb247 Update the comment.
svn path=/trunk/; revision=33777
2010-08-11 21:52:35 +00:00
Anders Broman ccf8787370 Add a warning message if H264 profile-level-id parameter wasn't
posible to parse.

svn path=/trunk/; revision=33776
2010-08-11 21:39:22 +00:00