diff options
author | Michael Mann <mmann78@netscape.net> | 2013-10-18 21:17:01 +0000 |
---|---|---|
committer | Michael Mann <mmann78@netscape.net> | 2013-10-18 21:17:01 +0000 |
commit | 2657071e882ad10b8a0a07da13e6f9fc9c56c67b (patch) | |
tree | 5125441237474cb4aa88733efadeda532b0accb1 /plugins/stats_tree | |
parent | d3a09e0514f5e380fbe012f43fae29f504124fd7 (diff) |
Don't allow invalid ranges to be specified for the stats tree. Bug 9130 (https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9130)
Not sure which memory allocation should be used here (using wmem caused crash), but this revision can at least be easily backported to 1.10 where the bug was reported.
Also allow a single number to be used in the stats range since it's considered a valid "range" by the UAT.
svn path=/trunk/; revision=52679
Diffstat (limited to 'plugins/stats_tree')
-rw-r--r-- | plugins/stats_tree/pinfo_stats_tree.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/plugins/stats_tree/pinfo_stats_tree.c b/plugins/stats_tree/pinfo_stats_tree.c index 6529040d98..6adf6d4605 100644 --- a/plugins/stats_tree/pinfo_stats_tree.c +++ b/plugins/stats_tree/pinfo_stats_tree.c @@ -68,6 +68,18 @@ static void* uat_plen_record_copy_cb(void* n, const void* o, size_t siz _U_) { return n; } +static void +uat_plen_record_update_cb(void *r, const char **err) +{ + uat_plen_record_t *rec = (uat_plen_record_t*)r; + if (rec->packet_range->nranges < 1) { + *err = ep_strdup_printf("Invalid range string"); + return; + } + + *err = NULL; +} + static void uat_plen_record_free_cb(void*r) { uat_plen_record_t* record = (uat_plen_record_t*)r; @@ -206,7 +218,7 @@ void register_pinfo_stat_trees(void) { 0, /* not a dissector, so affects neither dissection nor fields */ NULL, /* help */ uat_plen_record_copy_cb, /* copy callback */ - NULL, /* update callback */ + uat_plen_record_update_cb, /* update callback */ uat_plen_record_free_cb, /* free callback */ uat_plen_record_post_update_cb, /* post update callback */ plen_uat_flds); /* UAT field definitions */ |