DNS: fix name length and label count for a root server
Bug: 10674 Change-Id: I44297bfa64c31ab53d2aa61b6e54253b7a5a1e27 Reviewed-on: https://code.wireshark.org/review/5167 Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com> Tested-by: Pascal Quantin <pascal.quantin@gmail.com> Reviewed-by: Anders Broman <a.broman58@gmail.com>
This commit is contained in:
parent
14489d653c
commit
de37217933
|
@ -1327,17 +1327,20 @@ dissect_dns_query(tvbuff_t *tvb, int offset, int dns_data_offset,
|
|||
|
||||
proto_tree_add_string(q_tree, hf_dns_qry_name, tvb, offset, name_len, name);
|
||||
|
||||
tq = proto_tree_add_uint(q_tree, hf_dns_qry_name_len, tvb, offset, name_len, (guint32)strlen(name));
|
||||
tq = proto_tree_add_uint(q_tree, hf_dns_qry_name_len, tvb, offset, name_len, name_len > 1 ? (guint32)strlen(name) : 0);
|
||||
PROTO_ITEM_SET_GENERATED(tq);
|
||||
|
||||
/* Count how many '.' are in the string, plus 1, in order to count the number
|
||||
of labels */
|
||||
labels = 0;
|
||||
for (i = 0; i < strlen(name); i++) {
|
||||
if (name[i] == '.')
|
||||
labels++;
|
||||
if (name_len > 1) {
|
||||
/* it was not a Zero-length name */
|
||||
for (i = 0; i < strlen(name); i++) {
|
||||
if (name[i] == '.')
|
||||
labels++;
|
||||
}
|
||||
labels++;
|
||||
}
|
||||
labels++;
|
||||
tq = proto_tree_add_uint(q_tree, hf_dns_count_labels, tvb, offset, name_len, labels);
|
||||
PROTO_ITEM_SET_GENERATED(tq);
|
||||
|
||||
|
|
Loading…
Reference in New Issue