R-GOOSE dissector: Fix subtree item lengths

This commit is contained in:
Đorđije Manojlović 2020-12-15 10:46:30 +01:00 committed by AndersBroman
parent adb1b59495
commit 7e8392c784
2 changed files with 20 additions and 8 deletions

View File

@ -167,7 +167,7 @@ dissect_rgoose(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree,
void* data _U_) void* data _U_)
{ {
guint offset = 0, old_offset = 0; guint offset = 0, old_offset = 0;
guint32 init_v_length, payload_tag, padding_length; guint32 init_v_length, payload_tag, padding_length, length;
guint32 payload_length, apdu_offset = 0, apdu_length; guint32 payload_length, apdu_offset = 0, apdu_length;
proto_item *item = NULL; proto_item *item = NULL;
proto_tree *tree = NULL, *sess_user_info_tree = NULL; proto_tree *tree = NULL, *sess_user_info_tree = NULL;
@ -186,8 +186,10 @@ dissect_rgoose(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree,
proto_tree_add_item(tree, hf_goose_spdu_id, tvb, offset++, 1, proto_tree_add_item(tree, hf_goose_spdu_id, tvb, offset++, 1,
ENC_BIG_ENDIAN); ENC_BIG_ENDIAN);
/* Session header length */ /* Session header length */
proto_tree_add_item(tree, hf_goose_session_hdr_length, tvb, offset++, 1, proto_tree_add_item_ret_uint(tree, hf_goose_session_hdr_length, tvb, offset++, 1,
ENC_BIG_ENDIAN); ENC_BIG_ENDIAN, &length);
proto_item_set_len(item, length + 2);
/* Header content indicator */ /* Header content indicator */
proto_tree_add_item(tree, hf_goose_content_id, tvb, offset++, 1, proto_tree_add_item(tree, hf_goose_content_id, tvb, offset++, 1,
ENC_BIG_ENDIAN); ENC_BIG_ENDIAN);
@ -224,6 +226,8 @@ dissect_rgoose(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree,
/* Initialization vector length */ /* Initialization vector length */
proto_tree_add_item_ret_uint(tree, hf_goose_init_vec_length, tvb, offset++, 1, proto_tree_add_item_ret_uint(tree, hf_goose_init_vec_length, tvb, offset++, 1,
ENC_BIG_ENDIAN, &init_v_length); ENC_BIG_ENDIAN, &init_v_length);
proto_item_set_len(item, init_v_length + 11);
if (init_v_length > 0) { if (init_v_length > 0) {
/* Initialization vector bytes */ /* Initialization vector bytes */
proto_tree_add_item(tree, hf_goose_init_vec, tvb, offset, init_v_length, proto_tree_add_item(tree, hf_goose_init_vec, tvb, offset, init_v_length,
@ -290,6 +294,8 @@ dissect_rgoose(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree,
/* Padding length */ /* Padding length */
proto_tree_add_item_ret_uint(tree, hf_goose_padding_length, tvb, offset++, 1, proto_tree_add_item_ret_uint(tree, hf_goose_padding_length, tvb, offset++, 1,
ENC_BIG_ENDIAN, &padding_length); ENC_BIG_ENDIAN, &padding_length);
proto_item_set_len(item, padding_length + 1);
/* Padding bytes */ /* Padding bytes */
proto_tree_add_item(tree, hf_goose_padding, tvb, offset, padding_length, proto_tree_add_item(tree, hf_goose_padding, tvb, offset, padding_length,
ENC_NA); ENC_NA);

View File

@ -816,7 +816,7 @@ dissect_rgoose(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree,
void* data _U_) void* data _U_)
{ {
guint offset = 0, old_offset = 0; guint offset = 0, old_offset = 0;
guint32 init_v_length, payload_tag, padding_length; guint32 init_v_length, payload_tag, padding_length, length;
guint32 payload_length, apdu_offset = 0, apdu_length; guint32 payload_length, apdu_offset = 0, apdu_length;
proto_item *item = NULL; proto_item *item = NULL;
proto_tree *tree = NULL, *sess_user_info_tree = NULL; proto_tree *tree = NULL, *sess_user_info_tree = NULL;
@ -835,8 +835,10 @@ dissect_rgoose(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree,
proto_tree_add_item(tree, hf_goose_spdu_id, tvb, offset++, 1, proto_tree_add_item(tree, hf_goose_spdu_id, tvb, offset++, 1,
ENC_BIG_ENDIAN); ENC_BIG_ENDIAN);
/* Session header length */ /* Session header length */
proto_tree_add_item(tree, hf_goose_session_hdr_length, tvb, offset++, 1, proto_tree_add_item_ret_uint(tree, hf_goose_session_hdr_length, tvb, offset++, 1,
ENC_BIG_ENDIAN); ENC_BIG_ENDIAN, &length);
proto_item_set_len(item, length + 2);
/* Header content indicator */ /* Header content indicator */
proto_tree_add_item(tree, hf_goose_content_id, tvb, offset++, 1, proto_tree_add_item(tree, hf_goose_content_id, tvb, offset++, 1,
ENC_BIG_ENDIAN); ENC_BIG_ENDIAN);
@ -873,6 +875,8 @@ dissect_rgoose(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree,
/* Initialization vector length */ /* Initialization vector length */
proto_tree_add_item_ret_uint(tree, hf_goose_init_vec_length, tvb, offset++, 1, proto_tree_add_item_ret_uint(tree, hf_goose_init_vec_length, tvb, offset++, 1,
ENC_BIG_ENDIAN, &init_v_length); ENC_BIG_ENDIAN, &init_v_length);
proto_item_set_len(item, init_v_length + 11);
if (init_v_length > 0) { if (init_v_length > 0) {
/* Initialization vector bytes */ /* Initialization vector bytes */
proto_tree_add_item(tree, hf_goose_init_vec, tvb, offset, init_v_length, proto_tree_add_item(tree, hf_goose_init_vec, tvb, offset, init_v_length,
@ -939,6 +943,8 @@ dissect_rgoose(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree,
/* Padding length */ /* Padding length */
proto_tree_add_item_ret_uint(tree, hf_goose_padding_length, tvb, offset++, 1, proto_tree_add_item_ret_uint(tree, hf_goose_padding_length, tvb, offset++, 1,
ENC_BIG_ENDIAN, &padding_length); ENC_BIG_ENDIAN, &padding_length);
proto_item_set_len(item, padding_length + 1);
/* Padding bytes */ /* Padding bytes */
proto_tree_add_item(tree, hf_goose_padding, tvb, offset, padding_length, proto_tree_add_item(tree, hf_goose_padding, tvb, offset, padding_length,
ENC_NA); ENC_NA);
@ -1374,7 +1380,7 @@ void proto_register_goose(void) {
"UtcTime", HFILL }}, "UtcTime", HFILL }},
/*--- End of included file: packet-goose-hfarr.c ---*/ /*--- End of included file: packet-goose-hfarr.c ---*/
#line 488 "./asn1/goose/packet-goose-template.c" #line 494 "./asn1/goose/packet-goose-template.c"
}; };
/* List of subtrees */ /* List of subtrees */
@ -1407,7 +1413,7 @@ void proto_register_goose(void) {
&ett_goose_Data, &ett_goose_Data,
/*--- End of included file: packet-goose-ettarr.c ---*/ /*--- End of included file: packet-goose-ettarr.c ---*/
#line 499 "./asn1/goose/packet-goose-template.c" #line 505 "./asn1/goose/packet-goose-template.c"
}; };
static ei_register_info ei[] = { static ei_register_info ei[] = {