aboutsummaryrefslogtreecommitdiffstats
path: root/wiretap/wtap_opttypes.c
diff options
context:
space:
mode:
authorMichael Mann <mmann78@netscape.net>2016-02-26 17:10:02 -0500
committerMichael Mann <mmann78@netscape.net>2016-03-01 14:00:53 +0000
commit64a5cd9ce0e7e8ed1114dc86550e5888e70767e8 (patch)
tree1566f833741c91909c98892b6de18f2c5d4e3a75 /wiretap/wtap_opttypes.c
parente326e85a88967760d47aba5029cb70449d9d6e28 (diff)
Prevent use-after-free issues with pcapng.c/wtap_opttypes.c
Bug: 12173 Change-Id: Ifff28491073d50e088b26847830a3bc8835f4282 Reviewed-on: https://code.wireshark.org/review/14180 Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
Diffstat (limited to 'wiretap/wtap_opttypes.c')
-rw-r--r--wiretap/wtap_opttypes.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/wiretap/wtap_opttypes.c b/wiretap/wtap_opttypes.c
index 3486ef69a9..8a61297e26 100644
--- a/wiretap/wtap_opttypes.c
+++ b/wiretap/wtap_opttypes.c
@@ -155,16 +155,21 @@ static void wtap_optionblock_free_options(wtap_optionblock_t block)
void wtap_optionblock_free(wtap_optionblock_t block)
{
+ guint j;
+ wtap_optionblock_t if_stats;
+
if (block != NULL)
{
/* Need special consideration for freeing of the interface_statistics member */
if (block->type == WTAP_OPTION_BLOCK_IF_DESCR)
{
wtapng_if_descr_mandatory_t* mand = (wtapng_if_descr_mandatory_t*)block->mandatory_data;
- if (mand->num_stat_entries != 0)
- {
- g_array_free(mand->interface_statistics, TRUE);
+ for(j = 0; j < mand->num_stat_entries; j++) {
+ if_stats = g_array_index(mand->interface_statistics, wtap_optionblock_t, j);
+ wtap_optionblock_free(if_stats);
}
+
+ g_array_free(mand->interface_statistics, TRUE);
}
g_free(block->mandatory_data);