woww: Update SMSG_ADDON_INFO, fix endless array looping

The arrays would previously loop for the amount of bytes left, not the
amount of objects left.
This commit is contained in:
Gtker 2022-10-08 16:14:26 +02:00 committed by Alexis La Goutte
parent 53fa582c92
commit e561372278
1 changed files with 130 additions and 4 deletions

View File

@ -85,6 +85,7 @@ static int hf_woww_action_type = -1;
static int hf_woww_activate_taxi_reply = -1;
static int hf_woww_actual_roll = -1;
static int hf_woww_addon_info = -1;
static int hf_woww_addon_type = -1;
static int hf_woww_agility = -1;
static int hf_woww_ai_reaction = -1;
static int hf_woww_allow_movement = -1;
@ -397,6 +398,7 @@ static int hf_woww_ignore_name = -1;
static int hf_woww_ignored = -1;
static int hf_woww_inactive = -1;
static int hf_woww_index = -1;
static int hf_woww_info_block = -1;
static int hf_woww_info_type = -1;
static int hf_woww_initiator_guid = -1;
static int hf_woww_initiator_name = -1;
@ -452,6 +454,7 @@ static int hf_woww_item_text_id = -1;
static int hf_woww_item_trade_target = -1;
static int hf_woww_items_required = -1;
static int hf_woww_join_as_group = -1;
static int hf_woww_key_version = -1;
static int hf_woww_kill_count = -1;
static int hf_woww_killing_blows = -1;
static int hf_woww_lag = -1;
@ -611,6 +614,7 @@ static int hf_woww_power = -1;
static int hf_woww_power_type = -1;
static int hf_woww_price = -1;
static int hf_woww_probability = -1;
static int hf_woww_public_key = -1;
static int hf_woww_pvp_rank = -1;
static int hf_woww_quest_completable = -1;
static int hf_woww_quest_failed_reason = -1;
@ -838,8 +842,11 @@ static int hf_woww_unknown_guid = -1;
static int hf_woww_unknown_int = -1;
static int hf_woww_unread_mails = -1;
static int hf_woww_unused = -1;
static int hf_woww_update_available_flag = -1;
static int hf_woww_update_flag = -1;
static int hf_woww_update_type = -1;
static int hf_woww_url = -1;
static int hf_woww_url_info = -1;
static int hf_woww_usable = -1;
static int hf_woww_username = -1;
static int hf_woww_v_cos = -1;
@ -934,6 +941,64 @@ typedef struct {
} WowwDecryptedHeader_t;
/* AUTOGENERATED_START_ENUM */
typedef enum {
ADDON_TYPE_BANNED = 0x0,
ADDON_TYPE_ENABLED = 0x1,
ADDON_TYPE_BLIZZARD = 0x2,
} e_addon_type;
static const value_string e_addon_type_strings[] = {
{ ADDON_TYPE_BANNED, "Banned" },
{ ADDON_TYPE_ENABLED, "Enabled" },
{ ADDON_TYPE_BLIZZARD, "Blizzard" },
{ 0, NULL }
};
typedef enum {
INFO_BLOCK_UNAVAILABLE = 0x0,
INFO_BLOCK_AVAILABLE = 0x1,
} e_info_block;
static const value_string e_info_block_strings[] = {
{ INFO_BLOCK_UNAVAILABLE, "Unavailable" },
{ INFO_BLOCK_AVAILABLE, "Available" },
{ 0, NULL }
};
typedef enum {
KEY_VERSION_ZERO = 0x0,
KEY_VERSION_ONE = 0x1,
KEY_VERSION_TWO = 0x2,
KEY_VERSION_THREE = 0x3,
KEY_VERSION_FOUR = 0x4,
KEY_VERSION_FIVE = 0x5,
KEY_VERSION_SIX = 0x6,
KEY_VERSION_SEVEN = 0x7,
KEY_VERSION_EIGHT = 0x8,
KEY_VERSION_NINE = 0x9,
} e_key_version;
static const value_string e_key_version_strings[] = {
{ KEY_VERSION_ZERO, "Zero" },
{ KEY_VERSION_ONE, "One" },
{ KEY_VERSION_TWO, "Two" },
{ KEY_VERSION_THREE, "Three" },
{ KEY_VERSION_FOUR, "Four" },
{ KEY_VERSION_FIVE, "Five" },
{ KEY_VERSION_SIX, "Six" },
{ KEY_VERSION_SEVEN, "Seven" },
{ KEY_VERSION_EIGHT, "Eight" },
{ KEY_VERSION_NINE, "Nine" },
{ 0, NULL }
};
typedef enum {
URL_INFO_UNAVAILABLE = 0x0,
URL_INFO_AVAILABLE = 0x1,
} e_url_info;
static const value_string e_url_info_strings[] = {
{ URL_INFO_UNAVAILABLE, "Unavailable" },
{ URL_INFO_AVAILABLE, "Available" },
{ 0, NULL }
};
typedef enum {
AURA_TYPE_NONE = 0x00,
AURA_TYPE_BIND_SIGHT = 0x01,
@ -9124,6 +9189,8 @@ add_body_fields(guint32 opcode,
guint32 exp_type = 0;
guint32 flags = 0;
guint32 index = 0;
guint32 info_block = 0;
guint32 key_version = 0;
guint32 listed_players = 0;
guint32 map = 0;
guint32 mask = 0;
@ -9139,6 +9206,7 @@ add_body_fields(guint32 opcode,
guint32 target_flags = 0;
guint32 update_flag = 0;
guint32 update_type = 0;
guint32 url_info = 0;
/* AUTOGENERATED_END_VARIABLES */
ptvcursor_t* ptv = ptvcursor_new(wmem_packet_scope(), tree, tvb, offset);
/* AUTOGENERATED_START_PARSER */
@ -12575,7 +12643,23 @@ add_body_fields(guint32 opcode,
break;
case SMSG_ADDON_INFO:
len = offset_packet_end - ptvcursor_current_offset(ptv);
ptvcursor_add(ptv, hf_woww_unimplemented, len, ENC_NA);
while (ptvcursor_current_offset(ptv) < offset_packet_end) {
ptvcursor_add_text_with_subtree(ptv, SUBTREE_UNDEFINED_LENGTH, ett_message, "Addon");
ptvcursor_add(ptv, hf_woww_addon_type, 1, ENC_LITTLE_ENDIAN);
ptvcursor_add_ret_uint(ptv, hf_woww_info_block, 1, ENC_LITTLE_ENDIAN, &info_block);
if (info_block == INFO_BLOCK_AVAILABLE) {
ptvcursor_add_ret_uint(ptv, hf_woww_key_version, 1, ENC_LITTLE_ENDIAN, &key_version);
if (key_version != KEY_VERSION_ZERO) {
ptvcursor_add(ptv, hf_woww_public_key, 256, ENC_NA);
}
ptvcursor_add(ptv, hf_woww_update_available_flag, 4, ENC_LITTLE_ENDIAN);
}
ptvcursor_add_ret_uint(ptv, hf_woww_url_info, 1, ENC_LITTLE_ENDIAN, &url_info);
if (url_info == URL_INFO_AVAILABLE) {
add_cstring(ptv, &hf_woww_url);
}
ptvcursor_pop_subtree(ptv);
}
break;
case SMSG_AI_REACTION:
ptvcursor_add(ptv, hf_woww_guid, 8, ENC_LITTLE_ENDIAN);
@ -12920,7 +13004,7 @@ add_body_fields(guint32 opcode,
ptvcursor_add(ptv, hf_woww_caster_guid, 8, ENC_LITTLE_ENDIAN);
ptvcursor_add(ptv, hf_woww_target_guid, 8, ENC_LITTLE_ENDIAN);
len = offset_packet_end - ptvcursor_current_offset(ptv);
for (i = 0; i < len; ++i) {
while (ptvcursor_current_offset(ptv) < offset_packet_end) {
ptvcursor_add(ptv, hf_woww_spells, 4, ENC_LITTLE_ENDIAN);
}
break;
@ -14273,7 +14357,7 @@ add_body_fields(guint32 opcode,
ptvcursor_add(ptv, hf_woww_guid, 8, ENC_LITTLE_ENDIAN);
ptvcursor_add(ptv, hf_woww_nearest_node, 4, ENC_LITTLE_ENDIAN);
len = offset_packet_end - ptvcursor_current_offset(ptv);
for (i = 0; i < len; ++i) {
while (ptvcursor_current_offset(ptv) < offset_packet_end) {
ptvcursor_add(ptv, hf_woww_nodes, 4, ENC_LITTLE_ENDIAN);
}
break;
@ -14401,7 +14485,7 @@ add_body_fields(guint32 opcode,
case SMSG_SPELL_COOLDOWN:
ptvcursor_add(ptv, hf_woww_guid, 8, ENC_LITTLE_ENDIAN);
len = offset_packet_end - ptvcursor_current_offset(ptv);
for (i = 0; i < len; ++i) {
while (ptvcursor_current_offset(ptv) < offset_packet_end) {
ptvcursor_add_text_with_subtree(ptv, SUBTREE_UNDEFINED_LENGTH, ett_message, "SpellCooldownStatus");
ptvcursor_add(ptv, hf_woww_id, 4, ENC_LITTLE_ENDIAN);
ptvcursor_add(ptv, hf_woww_cooldown_time_in_msecs, 4, ENC_LITTLE_ENDIAN);
@ -15235,6 +15319,12 @@ proto_register_woww(void)
NULL, HFILL
}
},
{ &hf_woww_addon_type,
{ "Addon Type", "woww.addon.type",
FT_UINT8, BASE_HEX_DEC, VALS(e_addon_type_strings), 0,
NULL, HFILL
}
},
{ &hf_woww_agility,
{ "Agility", "woww.agility",
FT_UINT32, BASE_HEX_DEC, NULL, 0,
@ -17107,6 +17197,12 @@ proto_register_woww(void)
NULL, HFILL
}
},
{ &hf_woww_info_block,
{ "Info Block", "woww.info.block",
FT_UINT8, BASE_HEX_DEC, VALS(e_info_block_strings), 0,
NULL, HFILL
}
},
{ &hf_woww_info_type,
{ "Info Type", "woww.info.type",
FT_UINT32, BASE_HEX_DEC, NULL, 0,
@ -17437,6 +17533,12 @@ proto_register_woww(void)
NULL, HFILL
}
},
{ &hf_woww_key_version,
{ "Key Version", "woww.key.version",
FT_UINT8, BASE_HEX_DEC, VALS(e_key_version_strings), 0,
NULL, HFILL
}
},
{ &hf_woww_kill_count,
{ "Kill Count", "woww.kill.count",
FT_UINT32, BASE_HEX_DEC, NULL, 0,
@ -18391,6 +18493,12 @@ proto_register_woww(void)
NULL, HFILL
}
},
{ &hf_woww_public_key,
{ "Public Key", "woww.public.key",
FT_BYTES, BASE_NONE, NULL, 0,
NULL, HFILL
}
},
{ &hf_woww_pvp_rank,
{ "Pvp Rank", "woww.pvp.rank",
FT_UINT8, BASE_HEX_DEC, VALS(e_pvp_rank_strings), 0,
@ -19753,6 +19861,12 @@ proto_register_woww(void)
NULL, HFILL
}
},
{ &hf_woww_update_available_flag,
{ "Update Available Flag", "woww.update.available.flag",
FT_UINT32, BASE_HEX_DEC, NULL, 0,
NULL, HFILL
}
},
{ &hf_woww_update_flag,
{ "Update Flag", "woww.update.flag",
FT_UINT8, BASE_HEX_DEC, NULL, 0,
@ -19765,6 +19879,18 @@ proto_register_woww(void)
NULL, HFILL
}
},
{ &hf_woww_url,
{ "Url", "woww.url",
FT_STRINGZ, BASE_NONE, NULL, 0,
NULL, HFILL
}
},
{ &hf_woww_url_info,
{ "Url Info", "woww.url.info",
FT_UINT8, BASE_HEX_DEC, VALS(e_url_info_strings), 0,
NULL, HFILL
}
},
{ &hf_woww_usable,
{ "Usable", "woww.usable",
FT_UINT8, BASE_HEX_DEC, NULL, 0,