aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors
diff options
context:
space:
mode:
authorChris Maynard <Christopher.Maynard@GTECH.COM>2011-08-04 17:49:57 +0000
committerChris Maynard <Christopher.Maynard@GTECH.COM>2011-08-04 17:49:57 +0000
commitb4ce593083c01adb391b4f1a04971d2f75706a70 (patch)
tree5c78d831582e144caa170c343a991b198c004954 /epan/dissectors
parentafae0c92add9985f3d0ccf0f05c0f666af614311 (diff)
Don't call expert_add_info_format() from within an "if (tree)" block. Fixes bug 6198. Reference: https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=6198
svn path=/trunk/; revision=38339
Diffstat (limited to 'epan/dissectors')
-rw-r--r--epan/dissectors/packet-tcp.c40
1 files changed, 21 insertions, 19 deletions
diff --git a/epan/dissectors/packet-tcp.c b/epan/dissectors/packet-tcp.c
index 429ffc9577..8bf2cab7b1 100644
--- a/epan/dissectors/packet-tcp.c
+++ b/epan/dissectors/packet-tcp.c
@@ -3980,25 +3980,29 @@ dissect_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
PROTO_ITEM_SET_GENERATED(tf);
}
}
-
- if (tcph->th_flags & TH_ACK) {
+ }
+
+ if (tcph->th_flags & TH_ACK) {
+ if (tree) {
if (tcp_relative_seq){
proto_tree_add_uint_format(tcp_tree, hf_tcp_ack, tvb, offset + 8, 4, tcph->th_ack, "Acknowledgement number: %u (relative ack number)", tcph->th_ack);
} else {
proto_tree_add_uint(tcp_tree, hf_tcp_ack, tvb, offset + 8, 4, tcph->th_ack);
}
- } else {
- /* Verify that the ACK field is zero */
- ack = tvb_get_ntohl(tvb, offset+8);
- if (ack != 0){
- item = proto_tree_add_uint_format(tcp_tree, hf_tcp_ack, tvb, offset + 8, 4, ack,
- "Acknowledgement Number: 0x%08x [should be 0x00000000 because ACK flag is not set]",
- ack);
- expert_add_info_format(pinfo, item, PI_PROTOCOL, PI_WARN,
- "Acknowledgement number: Broken TCP. The acknowledge field is nonzero while the ACK flag is not set");
- }
}
+ } else {
+ /* Verify that the ACK field is zero */
+ ack = tvb_get_ntohl(tvb, offset+8);
+ if (ack != 0){
+ item = proto_tree_add_uint_format(tcp_tree, hf_tcp_ack, tvb, offset + 8, 4, ack,
+ "Acknowledgement Number: 0x%08x [should be 0x00000000 because ACK flag is not set]",
+ ack);
+ expert_add_info_format(pinfo, item, PI_PROTOCOL, PI_WARN,
+ "Acknowledgement number: Broken TCP. The acknowledge field is nonzero while the ACK flag is not set");
+ }
+ }
+ if (tree) {
proto_tree_add_uint_format(tcp_tree, hf_tcp_hdr_len, tvb, offset + 12, 1, tcph->th_hlen,
"Header length: %u bytes", tcph->th_hlen);
tf = proto_tree_add_uint_format(tcp_tree, hf_tcp_flags, tvb, offset + 12, 2,
@@ -4236,13 +4240,11 @@ dissect_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
} else {
tcpinfo.urgent = FALSE;
if (th_urp) {
- if (tcp_tree != NULL) {
- item = proto_tree_add_uint_format(tcp_tree, hf_tcp_urgent_pointer, tvb, offset + 18, 2, th_urp,
- "Urgent Pointer: 0x%04x [should be 0x0000 because URG flag is not set]",
- th_urp);
- expert_add_info_format(pinfo, item, PI_PROTOCOL, PI_WARN,
- "Urgent Pointer: Broken TCP. The urgent pointer field is nonzero while the URG flag is not set");
- }
+ item = proto_tree_add_uint_format(tcp_tree, hf_tcp_urgent_pointer, tvb, offset + 18, 2, th_urp,
+ "Urgent Pointer: 0x%04x [should be 0x0000 because URG flag is not set]",
+ th_urp);
+ expert_add_info_format(pinfo, item, PI_PROTOCOL, PI_WARN,
+ "Urgent Pointer: Broken TCP. The urgent pointer field is nonzero while the URG flag is not set");
}
}