summaryrefslogtreecommitdiff
path: root/epan/dissectors/packet-bt-utp.c
diff options
context:
space:
mode:
authorChris Maynard <Christopher.Maynard@GTECH.COM>2013-02-20 02:15:20 +0000
committerChris Maynard <Christopher.Maynard@GTECH.COM>2013-02-20 02:15:20 +0000
commit1455b36647fc017d0a7de8d432fdf7de2bb15d12 (patch)
tree34292c205da6fa296044c8907618cd00a1dbaf6a /epan/dissectors/packet-bt-utp.c
parentc5f0b686698c4b6ec0034b2f235e07007639e17c (diff)
downloadwireshark-1455b36647fc017d0a7de8d432fdf7de2bb15d12.tar.gz
Fix Coverity CID 751720: Logically dead code.
In fixing this bug, also fix another: Be sure to use tvb_length() and not tvb_reported_length() in get_utp_version(), since this is essentially where the heuristics are being applied to decide whether to accept the packet or not. svn path=/trunk/; revision=47761
Diffstat (limited to 'epan/dissectors/packet-bt-utp.c')
-rw-r--r--epan/dissectors/packet-bt-utp.c35
1 files changed, 17 insertions, 18 deletions
diff --git a/epan/dissectors/packet-bt-utp.c b/epan/dissectors/packet-bt-utp.c
index 0053d1f44b..87777d4e36 100644
--- a/epan/dissectors/packet-bt-utp.c
+++ b/epan/dissectors/packet-bt-utp.c
@@ -162,33 +162,32 @@ get_utp_version(tvbuff_t *tvb) {
/* Simple heuristics inspired by code from utp.cpp */
- len = tvb_reported_length(tvb);
+ len = tvb_length(tvb);
- if (len < MIN(V0_FIXED_HDR_SIZE, V1_FIXED_HDR_SIZE)) {
+ /* Version 1? */
+ if (len < V1_FIXED_HDR_SIZE) {
return -1;
}
v1_ver_type = tvb_get_guint8(tvb, 0);
- v1_ext = tvb_get_guint8(tvb, 1);
-
- v0_flags = tvb_get_guint8(tvb, 18);
- v0_ext = tvb_get_guint8(tvb, 17);
-
- if (((v1_ver_type & 0x0f) == 1) &&
- ((v1_ver_type>>4) < ST_NUM_STATES) &&
- (v1_ext < EXT_NUM_EXT)) {
- if (len < V1_FIXED_HDR_SIZE)
- return -1;
+ v1_ext = tvb_get_guint8(tvb, 1);
+ if (((v1_ver_type & 0x0f) == 1) && ((v1_ver_type>>4) < ST_NUM_STATES) &&
+ (v1_ext < EXT_NUM_EXT)) {
return 1;
}
- else if ((v0_flags < ST_NUM_STATES) ||
- (v0_ext < EXT_NUM_EXT)) {
- if (len < V0_FIXED_HDR_SIZE)
- return -1;
+
+ /* Version 0? */
+ if (len < V0_FIXED_HDR_SIZE) {
+ return -1;
+ }
+
+ v0_flags = tvb_get_guint8(tvb, 18);
+ v0_ext = tvb_get_guint8(tvb, 17);
+ if ((v0_flags < ST_NUM_STATES) || (v0_ext < EXT_NUM_EXT)) {
return 0;
}
- else
- return -1;
+
+ return -1;
}
static int