forked from osmocom/wireshark
Fix the fuzz failure in https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=5554 :
Don't assume that g_strsplit() found and returned 3 strings. svn path=/trunk/; revision=35418
This commit is contained in:
parent
863e3f80a6
commit
2c2990fc08
1 changed files with 14 additions and 12 deletions
|
@ -981,23 +981,25 @@ add_rr_to_tree(proto_item *trr, int rr_type, tvbuff_t *tvb, int offset,
|
|||
rr_tree = proto_item_add_subtree(trr, rr_type);
|
||||
|
||||
if(type == T_SRV) {
|
||||
srv_rr_info = g_strsplit(name, ".", 3);
|
||||
srv_rr_info = g_strsplit(name, ".", 3);
|
||||
|
||||
/* The + 1 on the strings is to skip the leading '_' */
|
||||
|
||||
proto_tree_add_string(rr_tree, hf_dns_srv_service, tvb, offset,
|
||||
namelen, srv_rr_info[0]+1);
|
||||
/* The + 1 on the strings is to skip the leading '_' */
|
||||
|
||||
proto_tree_add_string(rr_tree, hf_dns_srv_proto, tvb, offset,
|
||||
namelen, srv_rr_info[1]+1);
|
||||
proto_tree_add_string(rr_tree, hf_dns_srv_service, tvb, offset,
|
||||
namelen, srv_rr_info[0]+1);
|
||||
|
||||
proto_tree_add_string(rr_tree, hf_dns_srv_name, tvb, offset,
|
||||
namelen, srv_rr_info[2]);
|
||||
if (srv_rr_info[1]) {
|
||||
proto_tree_add_string(rr_tree, hf_dns_srv_proto, tvb, offset,
|
||||
namelen, srv_rr_info[1]+1);
|
||||
|
||||
g_strfreev(srv_rr_info);
|
||||
if (srv_rr_info[2])
|
||||
proto_tree_add_string(rr_tree, hf_dns_srv_name, tvb, offset,
|
||||
namelen, srv_rr_info[2]);
|
||||
}
|
||||
|
||||
g_strfreev(srv_rr_info);
|
||||
} else {
|
||||
proto_tree_add_string(rr_tree, hf_dns_rr_name, tvb, offset,
|
||||
namelen, name);
|
||||
proto_tree_add_string(rr_tree, hf_dns_rr_name, tvb, offset, namelen, name);
|
||||
}
|
||||
|
||||
offset += namelen;
|
||||
|
|
Loading…
Reference in a new issue