aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBill Meier <wmeier@newsguy.com>2011-05-23 14:30:00 +0000
committerBill Meier <wmeier@newsguy.com>2011-05-23 14:30:00 +0000
commit0c08ae45c2b3e352d113e978b020b858cbc7650c (patch)
treec87dc1269382956553e27226c735209f4fa021cc
parentb6111d3c9faee85d79b3355d5d4daffa7cd34c23 (diff)
Use correct subtree in two cases: Fixes Coverity 920;
Also: Remove a number of unneeded #include statements; Do some whitespace cleanup. svn path=/trunk/; revision=37363
-rw-r--r--epan/dissectors/packet-h221_nonstd.c94
1 files changed, 41 insertions, 53 deletions
diff --git a/epan/dissectors/packet-h221_nonstd.c b/epan/dissectors/packet-h221_nonstd.c
index 373f3f0297..0fda44da12 100644
--- a/epan/dissectors/packet-h221_nonstd.c
+++ b/epan/dissectors/packet-h221_nonstd.c
@@ -26,15 +26,8 @@
#include "config.h"
#endif
-#include <stdlib.h>
-#include <gmodule.h>
-#include <ctype.h>
-#include <time.h>
+#include <glib.h>
#include <epan/packet.h>
-#include <epan/addr_resolv.h>
-#include <epan/strutil.h>
-#include <epan/asn1.h>
-#include <epan/dissectors/packet-per.h>
/* Define the nonstd proto */
static int proto_nonstd = -1;
@@ -46,15 +39,15 @@ static int proto_nonstd = -1;
static int ett_nonstd = -1;
const value_string ms_codec_vals[] = {
- { 0x0111, "L&H CELP 4.8k" },
- { 0x0200, "MS-ADPCM" },
- { 0x0211, "L&H CELP 8k" },
- { 0x0311, "L&H CELP 12k" },
- { 0x0411, "L&H CELP 16k" },
- { 0x1100, "IMA-ADPCM" },
- { 0x3100, "MS-GSM" },
- { 0xfeff, "E-AMR" },
- { 0, NULL }
+ { 0x0111, "L&H CELP 4.8k" },
+ { 0x0200, "MS-ADPCM" },
+ { 0x0211, "L&H CELP 8k" },
+ { 0x0311, "L&H CELP 12k" },
+ { 0x0411, "L&H CELP 16k" },
+ { 0x1100, "IMA-ADPCM" },
+ { 0x3100, "MS-GSM" },
+ { 0xfeff, "E-AMR" },
+ { 0, NULL }
};
static void
@@ -66,75 +59,70 @@ dissect_ms_nonstd(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
gint tvb_len;
guint16 codec_value, codec_extra;
- it=proto_tree_add_protocol_format(tree, proto_nonstd, tvb, 0, tvb_length(tvb), "Microsoft NonStd");
- tr=proto_item_add_subtree(it, ett_nonstd);
+ it=proto_tree_add_protocol_format(tree, proto_nonstd, tvb, 0, tvb_length(tvb), "Microsoft NonStd");
+ tr=proto_item_add_subtree(it, ett_nonstd);
- tvb_len = tvb_length(tvb);
+ tvb_len = tvb_length(tvb);
- /*
- * XXX - why do this test? Are there any cases where throwing
- * an exception if the tvbuff is too short causes subsequent stuff
- * in the packet not to be dissected (e.g., if the octet string
- * containing the non-standard data is too short for the data
- * supposedly contained in it, and is followed by more items)?
- *
- * If so, the right fix might be to catch ReportedBoundsError in
- * the dissector calling this dissector, and report a malformed
- * nonStandardData item, and rethrow other exceptions (as a
- * BoundsError means you really *have* run out of packet data).
- */
- if(tvb_len >= 23)
- {
+ /*
+ * XXX - why do this test? Are there any cases where throwing
+ * an exception if the tvbuff is too short causes subsequent stuff
+ * in the packet not to be dissected (e.g., if the octet string
+ * containing the non-standard data is too short for the data
+ * supposedly contained in it, and is followed by more items)?
+ *
+ * If so, the right fix might be to catch ReportedBoundsError in
+ * the dissector calling this dissector, and report a malformed
+ * nonStandardData item, and rethrow other exceptions (as a
+ * BoundsError means you really *have* run out of packet data).
+ */
+ if(tvb_len >= 23)
+ {
codec_value = tvb_get_ntohs(tvb,offset+20);
codec_extra = tvb_get_ntohs(tvb,offset+22);
-
if(codec_extra == 0x0100)
{
- proto_tree_add_text(tree, tvb, offset+20,2, "Microsoft NetMeeting Codec=0x%04X %s",
- codec_value,val_to_str(codec_value, ms_codec_vals,"Unknown (%u)"));
+ proto_tree_add_text(tr, tvb, offset+20, 2, "Microsoft NetMeeting Codec=0x%04X %s",
+ codec_value,val_to_str(codec_value, ms_codec_vals,"Unknown (%u)"));
}
else
{
- proto_tree_add_text(tree, tvb, offset,-1, "Microsoft NetMeeting Non Standard");
+ proto_tree_add_text(tr, tvb, offset, -1, "Microsoft NetMeeting Non Standard");
}
-
- }
-
-
+ }
}
+
/* Register all the bits needed with the filtering engine */
void
proto_register_nonstd(void)
{
- static gint *ett[] = {
- &ett_nonstd,
- };
+ static gint *ett[] = {
+ &ett_nonstd,
+ };
+ proto_nonstd = proto_register_protocol("H221NonStandard","h221nonstd", "h221nonstd");
- proto_nonstd = proto_register_protocol("H221NonStandard","h221nonstd", "h221nonstd");
-
- proto_register_subtree_array(ett, array_length(ett));
+ proto_register_subtree_array(ett, array_length(ett));
}
/* The registration hand-off routine */
void
proto_reg_handoff_nonstd(void)
{
- static dissector_handle_t ms_nonstd_handle;
-
+ static dissector_handle_t ms_nonstd_handle;
- ms_nonstd_handle = create_dissector_handle(dissect_ms_nonstd, proto_nonstd);
+ ms_nonstd_handle = create_dissector_handle(dissect_ms_nonstd, proto_nonstd);
- dissector_add_uint("h245.nsp.h221",0xb500534c, ms_nonstd_handle);
- dissector_add_uint("h225.nsp.h221",0xb500534c, ms_nonstd_handle);
+ dissector_add_uint("h245.nsp.h221",0xb500534c, ms_nonstd_handle);
+ dissector_add_uint("h225.nsp.h221",0xb500534c, ms_nonstd_handle);
}