Check to make sure the name length <= DLM3_RESNAME_MAXLEN.

If it's not, we'd misdissect it.

Hopefully this fixes the *real* problem that CID 1363031 was complaining
about.

Change-Id: If1fc7c30f72d75b9dc047d7e475f78c9d5869943
Reviewed-on: https://code.wireshark.org/review/16292
Reviewed-by: Guy Harris <guy@alum.mit.edu>
This commit is contained in:
Guy Harris 2016-07-04 13:52:20 -07:00
parent 7490ad4480
commit 6b5d8390f2
1 changed files with 17 additions and 13 deletions

View File

@ -756,21 +756,25 @@ dissect_dlm3_rcom_lock(tvbuff_t *tvb, proto_tree *tree,
namelen);
offset += 2;
sub_item = proto_tree_add_item(tree,
hf_dlm3_rl_name, tvb, offset,
DLM3_RESNAME_MAXLEN, ENC_NA);
if (namelen <= DLM3_RESNAME_MAXLEN) {
sub_item = proto_tree_add_item(tree,
hf_dlm3_rl_name, tvb, offset,
DLM3_RESNAME_MAXLEN, ENC_NA);
sub_tree = proto_item_add_subtree(sub_item,
ett_dlm3_rl_name);
sub_offset = offset;
proto_tree_add_item(sub_tree,
hf_dlm3_rl_name_contents, tvb, sub_offset,
namelen, ENC_ASCII|ENC_NA);
sub_tree = proto_item_add_subtree(sub_item,
ett_dlm3_rl_name);
sub_offset = offset;
proto_tree_add_item(sub_tree,
hf_dlm3_rl_name_contents, tvb, sub_offset,
namelen, ENC_ASCII|ENC_NA);
sub_offset += namelen;
proto_tree_add_item(sub_tree,
hf_dlm3_rl_name_padding, tvb, sub_offset,
DLM3_RESNAME_MAXLEN - namelen, ENC_NA);
sub_offset += namelen;
proto_tree_add_item(sub_tree,
hf_dlm3_rl_name_padding, tvb, sub_offset,
DLM3_RESNAME_MAXLEN - namelen, ENC_NA);
} else {
/* XXX - report an error */
}
offset += DLM3_RESNAME_MAXLEN;
if (((length - offset) > 0) && (exflags & DLM3_LKF_VALBLK))