aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexis La Goutte <alexis.lagoutte@gmail.com>2014-10-26 11:08:35 +0100
committerAnders Broman <a.broman58@gmail.com>2014-10-28 07:09:34 +0000
commit09957ca41875abda6e9ea24f35eb15f93dacb618 (patch)
tree7c70a86ac76ee497e24bcf7cce98761a76527993
parent25448b01bdf06ec8011afd9af9167e8081a42d0c (diff)
DNS NXT RR is parsed incorrectly
The queries RRs and answers RRs are parsed fine. However, only the first 2 authoritative RRs are parsed and none of the 3 additional RRs are parsed. The second authoritative RR is of type NXT, and even though it has data length of 9, Wireshark reads all the bytes until the end of the packet as if they are part of bitmap in this RR (it reads 317 bytes too many). This causes it to not parse the rest of the RRs correctly. Found by boaz Bug:10615 Change-Id: I22e5987c44a11399b07c3106fbb70c6e9e867afe Reviewed-on: https://code.wireshark.org/review/4940 Reviewed-by: Michael Mann <mmann78@netscape.net> Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
-rw-r--r--epan/dissectors/packet-dns.c29
1 files changed, 28 insertions, 1 deletions
diff --git a/epan/dissectors/packet-dns.c b/epan/dissectors/packet-dns.c
index 1abe0ca976..bda4e8378b 100644
--- a/epan/dissectors/packet-dns.c
+++ b/epan/dissectors/packet-dns.c
@@ -1476,6 +1476,33 @@ dissect_type_bitmap(proto_tree *rr_tree, tvbuff_t *tvb, int cur_offset, int rr_l
return(initial_offset - cur_offset);
}
+static int
+dissect_type_bitmap_nxt(proto_tree *rr_tree, tvbuff_t *tvb, int cur_offset, int rr_len)
+{
+ int mask;
+ int i, initial_offset, rr_type;
+ guint8 bits;
+
+ initial_offset = cur_offset;
+ rr_type = 0;
+ while (rr_len != 0) {
+ bits = tvb_get_guint8(tvb, cur_offset);
+ mask = 1<<7;
+ for (i = 0; i < 8; i++) {
+ if (bits & mask) {
+ proto_tree_add_uint_format(rr_tree, hf_dns_rr_type, tvb, cur_offset, 1, rr_type,
+ "RR type in bit map: %s",
+ val_to_str_ext(rr_type, &dns_types_description_vals_ext, "Unknown (%d)"));
+ }
+ mask >>= 1;
+ rr_type++;
+ }
+ cur_offset += 1;
+ rr_len -= 1;
+ }
+
+ return(initial_offset - cur_offset);
+}
/*
* SIG, KEY, and CERT RR algorithms.
* http://www.iana.org/assignments/dns-sec-alg-numbers/dns-sec-alg-numbers.txt (last updated 2012-04-13)
@@ -2370,7 +2397,7 @@ dissect_dns_answer(tvbuff_t *tvb, int offsetx, int dns_data_offset,
proto_tree_add_string(rr_tree, hf_dns_nxt_next_domain_name, tvb, cur_offset, next_domain_name_len, name_out);
cur_offset += next_domain_name_len;
rr_len -= next_domain_name_len;
- dissect_type_bitmap(rr_tree, tvb, cur_offset, rr_len);
+ dissect_type_bitmap_nxt(rr_tree, tvb, cur_offset, rr_len);
}
break;