summaryrefslogtreecommitdiff
path: root/epan
diff options
context:
space:
mode:
authorPascal Quantin <pascal.quantin@gmail.com>2017-01-20 23:10:43 +0100
committerAnders Broman <a.broman58@gmail.com>2017-01-22 08:13:25 +0000
commit7722003908ade4d36365c0a11e8a37895edfc066 (patch)
tree061d37a015b9259a09870475dd29f90d2fe74fc6 /epan
parent02127395981932bd6262d2107b78820ca4ace45b (diff)
downloadwireshark-7722003908ade4d36365c0a11e8a37895edfc066.tar.gz
DNS: use formatted text in add_rr_to_tree() and add_opt_rr_to_tree
Since the fix for bug 13289, an empty string can be returned by get_dns_name. Ensure that: - a malformed encoding with no characters and a length > 1 triggers an exception - the formatted version is used to add info in tree. Bug: 13339 Change-Id: I88125a351904eabb5cededfbfe1d5ef14ea61ecc Reviewed-on: https://code.wireshark.org/review/19714 Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com> Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'epan')
-rw-r--r--epan/dissectors/packet-dns.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/epan/dissectors/packet-dns.c b/epan/dissectors/packet-dns.c
index 2abfdbcbbd..658572a1ee 100644
--- a/epan/dissectors/packet-dns.c
+++ b/epan/dissectors/packet-dns.c
@@ -1295,7 +1295,7 @@ expand_dns_name(tvbuff_t *tvb, int offset, int max_len, int dns_data_offset,
if (len < 0) {
len = offset - start_offset;
}
- if (len < min_len) {
+ if ((len < min_len) || (len > min_len && *name_len == 0)) {
THROW(ReportedBoundsError);
}
return len;
@@ -1793,13 +1793,13 @@ dissect_dns_answer(tvbuff_t *tvb, int offsetx, int dns_data_offset,
(data_offset - data_start) + data_len,
ett_dns_rr, &trr, "%s: type %s, class %s",
name_out, type_name, class_name);
- add_rr_to_tree(rr_tree, tvb, offsetx, name, used_bytes - 4,
+ add_rr_to_tree(rr_tree, tvb, offsetx, name_out, used_bytes - 4,
dns_type, pinfo, is_mdns);
} else {
rr_tree = proto_tree_add_subtree_format(dns_tree, tvb, offsetx,
(data_offset - data_start) + data_len,
ett_dns_rr, &trr, "%s: type %s", name_out, type_name);
- add_opt_rr_to_tree(rr_tree, tvb, offsetx, name, used_bytes - 4, is_mdns);
+ add_opt_rr_to_tree(rr_tree, tvb, offsetx, name_out, used_bytes - 4, is_mdns);
}
if (is_mdns && flush) {
proto_item_append_text(trr, ", cache flush");