diff options
author | Alexis La Goutte <alexis.lagoutte@gmail.com> | 2017-12-24 08:29:50 +0100 |
---|---|---|
committer | Anders Broman <a.broman58@gmail.com> | 2018-01-02 05:29:39 +0000 |
commit | 0bde3e96f0c51ed141e94ae82eed24f1a38f712c (patch) | |
tree | 0518754ff0e74439b6e345eea50a0dd32ff131a5 /epan/dissectors | |
parent | af6dee35715a4079acaa7d9a413b6f7d859c8c8b (diff) |
Add ENC_VARINT_QUIC
Used to support variable length in QUIC protocol
Bug: 13881
Change-Id: Ia274b1530152376c5fb4e364fc4cf5ab246be1b3
Reviewed-on: https://code.wireshark.org/review/24990
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Craig Jackson <cejackson51@gmail.com>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'epan/dissectors')
-rw-r--r-- | epan/dissectors/file-elf.c | 6 | ||||
-rw-r--r-- | epan/dissectors/packet-mqtt.c | 6 | ||||
-rw-r--r-- | epan/dissectors/packet-netsync.c | 20 | ||||
-rw-r--r-- | epan/dissectors/packet-protobuf.c | 8 |
4 files changed, 20 insertions, 20 deletions
diff --git a/epan/dissectors/file-elf.c b/epan/dissectors/file-elf.c index 824c903eae..7939a185a6 100644 --- a/epan/dissectors/file-elf.c +++ b/epan/dissectors/file-elf.c @@ -908,7 +908,7 @@ dissect_eh_frame_hdr(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *segment_ if (efp_length == LENGTH_ULEB128) { guint64 value; - efp_length = tvb_get_varint(tvb, offset, FT_VARINT_MAX_LEN, &value); + efp_length = tvb_get_varint(tvb, offset, FT_VARINT_MAX_LEN, &value, ENC_VARINT_PROTOBUF); } else if (efp_length == LENGTH_LEB128) { gint64 value; @@ -920,7 +920,7 @@ dissect_eh_frame_hdr(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *segment_ if (fde_count_length == LENGTH_ULEB128) { - fde_count_length = tvb_get_varint(tvb, offset, FT_VARINT_MAX_LEN, &fde_count); + fde_count_length = tvb_get_varint(tvb, offset, FT_VARINT_MAX_LEN, &fde_count, ENC_VARINT_PROTOBUF); } else if (fde_count_length == LENGTH_LEB128) { gint64 value; @@ -953,7 +953,7 @@ dissect_eh_frame_hdr(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *segment_ if (table_entry_length == LENGTH_ULEB128) { guint64 value; - table_entry_length = tvb_get_varint(tvb, offset, FT_VARINT_MAX_LEN, &value); + table_entry_length = tvb_get_varint(tvb, offset, FT_VARINT_MAX_LEN, &value, ENC_VARINT_PROTOBUF); } else if (table_entry_length == LENGTH_LEB128) { gint64 value; diff --git a/epan/dissectors/packet-mqtt.c b/epan/dissectors/packet-mqtt.c index a441066808..742ac0584a 100644 --- a/epan/dissectors/packet-mqtt.c +++ b/epan/dissectors/packet-mqtt.c @@ -588,7 +588,7 @@ static guint get_mqtt_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, guint64 msg_len; guint len_offset; - len_offset = tvb_get_varint(tvb, (offset + MQTT_HDR_SIZE_BEFORE_LEN), FT_VARINT_MAX_LEN, &msg_len); + len_offset = tvb_get_varint(tvb, (offset + MQTT_HDR_SIZE_BEFORE_LEN), FT_VARINT_MAX_LEN, &msg_len, ENC_VARINT_PROTOBUF); /* Explicitly downcast the value, because the length can never be more than 4 bytes */ return (guint)(msg_len + len_offset + MQTT_HDR_SIZE_BEFORE_LEN); @@ -753,7 +753,7 @@ static guint dissect_mqtt_properties(tvbuff_t *tvb, proto_tree *mqtt_tree, guint proto_item *ti; guint64 vbi; - const guint mqtt_prop_offset = tvb_get_varint(tvb, offset, FT_VARINT_MAX_LEN, &vbi); + const guint mqtt_prop_offset = tvb_get_varint(tvb, offset, FT_VARINT_MAX_LEN, &vbi, ENC_VARINT_PROTOBUF); /* Property Length field can be stored in uint32 */ const guint mqtt_prop_len = (gint)vbi; @@ -925,7 +925,7 @@ static int dissect_mqtt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, voi conversation_add_proto_data(conv, proto_mqtt, mqtt); } - mqtt_len_offset = tvb_get_varint(tvb, (offset + MQTT_HDR_SIZE_BEFORE_LEN), FT_VARINT_MAX_LEN, &msg_len); + mqtt_len_offset = tvb_get_varint(tvb, (offset + MQTT_HDR_SIZE_BEFORE_LEN), FT_VARINT_MAX_LEN, &msg_len, ENC_VARINT_PROTOBUF); /* Explicit downcast, typically maximum length of message could be 4 bytes */ mqtt_msg_len = (gint) msg_len; diff --git a/epan/dissectors/packet-netsync.c b/epan/dissectors/packet-netsync.c index 422665a48b..23e655de18 100644 --- a/epan/dissectors/packet-netsync.c +++ b/epan/dissectors/packet-netsync.c @@ -157,7 +157,7 @@ static gint dissect_netsync_cmd_error( tvbuff_t *tvb, gint offset, proto_tree * { guint64 len = 0; - offset += tvb_get_varint( tvb, offset, FT_VARINT_MAX_LEN, &len ); + offset += tvb_get_varint( tvb, offset, FT_VARINT_MAX_LEN, &len, ENC_VARINT_PROTOBUF ); proto_tree_add_item(tree, hf_netsync_cmd_error_msg, tvb, offset, (gint)len, ENC_ASCII|ENC_NA ); @@ -176,13 +176,13 @@ static gint dissect_netsync_cmd_hello(tvbuff_t *tvb, gint offset, proto_tree *t { guint64 len = 0; - offset += tvb_get_varint( tvb, offset, FT_VARINT_MAX_LEN, &len ); + offset += tvb_get_varint( tvb, offset, FT_VARINT_MAX_LEN, &len, ENC_VARINT_PROTOBUF ); proto_tree_add_item(tree, hf_netsync_cmd_hello_keyname, tvb, offset, (gint)len, ENC_ASCII|ENC_NA ); offset += (gint)len; - offset += tvb_get_varint( tvb, offset, FT_VARINT_MAX_LEN, &len ); + offset += tvb_get_varint( tvb, offset, FT_VARINT_MAX_LEN, &len, ENC_VARINT_PROTOBUF ); proto_tree_add_item(tree, hf_netsync_cmd_hello_key, tvb, offset, (gint)len, ENC_NA ); offset += (gint)len; @@ -203,7 +203,7 @@ static gint dissect_netsync_cmd_anonymous(tvbuff_t *tvb, gint offset, proto_tre offset, 1, ENC_BIG_ENDIAN ); offset += 1; - offset += tvb_get_varint( tvb, offset, FT_VARINT_MAX_LEN, &len ); + offset += tvb_get_varint( tvb, offset, FT_VARINT_MAX_LEN, &len, ENC_VARINT_PROTOBUF ); proto_tree_add_item(tree, hf_netsync_cmd_anonymous_collection, tvb, offset, (gint)len, ENC_ASCII|ENC_NA ); offset += (gint)len; @@ -225,7 +225,7 @@ static gint dissect_netsync_cmd_auth(tvbuff_t *tvb, gint offset, proto_tree *tr offset += 1; - offset += tvb_get_varint( tvb, offset, FT_VARINT_MAX_LEN, &len ); + offset += tvb_get_varint( tvb, offset, FT_VARINT_MAX_LEN, &len, ENC_VARINT_PROTOBUF ); proto_tree_add_item(tree, hf_netsync_cmd_auth_collection, tvb, offset, (gint)len, ENC_ASCII|ENC_NA ); offset += (gint)len; @@ -246,7 +246,7 @@ static gint dissect_netsync_cmd_auth(tvbuff_t *tvb, gint offset, proto_tree *tr offset, NETSNYC_MERKLE_HASH_LENGTH, ENC_NA ); offset += NETSNYC_MERKLE_HASH_LENGTH; - offset += tvb_get_varint( tvb, offset, FT_VARINT_MAX_LEN, &len ); + offset += tvb_get_varint( tvb, offset, FT_VARINT_MAX_LEN, &len, ENC_VARINT_PROTOBUF ); proto_tree_add_item(tree, hf_netsync_cmd_auth_sig, tvb, offset, (gint)len, ENC_NA ); offset += (gint)len; @@ -259,7 +259,7 @@ static gint dissect_netsync_cmd_confirm(tvbuff_t *tvb, gint offset, proto_tree { guint64 len = 0; - offset += tvb_get_varint( tvb, offset, FT_VARINT_MAX_LEN, &len ); + offset += tvb_get_varint( tvb, offset, FT_VARINT_MAX_LEN, &len, ENC_VARINT_PROTOBUF ); proto_tree_add_item(tree, hf_netsync_cmd_confirm_sig, tvb, offset, (gint)len, ENC_NA ); offset += (gint)len; @@ -344,7 +344,7 @@ static gint dissect_netsync_cmd_data(tvbuff_t *tvb, gint offset, proto_tree *tr offset, 1, ENC_BIG_ENDIAN ); offset += 1; - offset += tvb_get_varint( tvb, offset, FT_VARINT_MAX_LEN, &len ); + offset += tvb_get_varint( tvb, offset, FT_VARINT_MAX_LEN, &len, ENC_VARINT_PROTOBUF ); proto_tree_add_item(tree, hf_netsync_cmd_data_payload, tvb, offset, (gint)len, ENC_NA ); offset += (gint)len; @@ -373,7 +373,7 @@ static gint dissect_netsync_cmd_delta(tvbuff_t *tvb, gint offset, proto_tree *t offset, 1, ENC_BIG_ENDIAN ); offset += 1; - offset += tvb_get_varint( tvb, offset, FT_VARINT_MAX_LEN, &len ); + offset += tvb_get_varint( tvb, offset, FT_VARINT_MAX_LEN, &len, ENC_VARINT_PROTOBUF ); proto_tree_add_item(tree, hf_netsync_cmd_delta_payload, tvb, offset, (gint)len, ENC_NA ); offset += (gint)len; @@ -404,7 +404,7 @@ get_netsync_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset, void *dat /* skip version and command */ offset += 2; - size_bytes = tvb_get_varint( tvb, offset, FT_VARINT_MAX_LEN, &size ); + size_bytes = tvb_get_varint( tvb, offset, FT_VARINT_MAX_LEN, &size, ENC_VARINT_PROTOBUF ); /* the calculated size if for the data only, this doesn't * include the version (1 byte), command (1 byte), diff --git a/epan/dissectors/packet-protobuf.c b/epan/dissectors/packet-protobuf.c index 6a4e27de23..ee18f66f28 100644 --- a/epan/dissectors/packet-protobuf.c +++ b/epan/dissectors/packet-protobuf.c @@ -225,7 +225,7 @@ dissect_packed_repeated_field_values(proto_tree *value_tree, tvbuff_t *tvb, guin /* add varints into the packed-repeated subtree */ while (offset < max_offset) { - sub_value_length = tvb_get_varint(tvb, offset, max_offset - offset, &sub_value); + sub_value_length = tvb_get_varint(tvb, offset, max_offset - offset, &sub_value, ENC_VARINT_PROTOBUF); if (sub_value_length == 0) { /* not a valid packed repeated field */ return 0; @@ -408,7 +408,7 @@ dissect_one_protobuf_field(tvbuff_t *tvb, guint* offset, guint maxlen, packet_in field_tree = proto_tree_add_subtree(protobuf_tree, tvb, *offset, 0, ett_protobuf_field, &ti_field, "Field"); /* parsing Tag */ - tag_length = tvb_get_varint(tvb, *offset, maxlen, &tag_value); + tag_length = tvb_get_varint(tvb, *offset, maxlen, &tag_value, ENC_VARINT_PROTOBUF); if (tag_length == 0) { /* not found a valid varint */ expert_add_info(pinfo, ti_field, &ei_protobuf_failed_parse_tag); @@ -426,7 +426,7 @@ dissect_one_protobuf_field(tvbuff_t *tvb, guint* offset, guint maxlen, packet_in { case PROTOBUF_WIRETYPE_VARINT: /* varint, format: tag + varint */ /* get value length and real value */ - value_length = tvb_get_varint(tvb, *offset, maxlen - tag_length, &value_uint64); + value_length = tvb_get_varint(tvb, *offset, maxlen - tag_length, &value_uint64, ENC_VARINT_PROTOBUF); if (value_length == 0) { expert_add_info(pinfo, ti_wire, &ei_protobuf_failed_parse_field); return FALSE; @@ -446,7 +446,7 @@ dissect_one_protobuf_field(tvbuff_t *tvb, guint* offset, guint maxlen, packet_in case PROTOBUF_WIRETYPE_LENGTH_DELIMITED: /* Length-delimited, format: tag + length(varint) + bytes_value */ /* this time value_uint64 is the length of following value bytes */ - value_length_size = tvb_get_varint(tvb, *offset, maxlen - tag_length, &value_uint64); + value_length_size = tvb_get_varint(tvb, *offset, maxlen - tag_length, &value_uint64, ENC_VARINT_PROTOBUF); if (value_length_size == 0) { expert_add_info(pinfo, ti_field, &ei_protobuf_failed_parse_length_delimited_field); return FALSE; |