aboutsummaryrefslogtreecommitdiffstats
path: root/epan/epan.c
diff options
context:
space:
mode:
Diffstat (limited to 'epan/epan.c')
-rw-r--r--epan/epan.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/epan/epan.c b/epan/epan.c
index cc4327d270..f06d4c0ea6 100644
--- a/epan/epan.c
+++ b/epan/epan.c
@@ -98,6 +98,12 @@ static GSList *epan_plugin_register_all_handoffs = NULL;
static wmem_allocator_t *pinfo_pool_cache = NULL;
+/* Global variables holding the content of the corresponding environment variable
+ * to save fetching it repeatedly.
+ */
+gboolean wireshark_abort_on_dissector_bug = FALSE;
+gboolean wireshark_abort_on_too_many_items = FALSE;
+
#ifdef HAVE_PLUGINS
plugins_t *libwireshark_plugins = NULL;
static GSList *epan_plugins = NULL;
@@ -192,6 +198,22 @@ epan_init(register_cb cb, gpointer client_data, gboolean load_plugins)
{
volatile gboolean status = TRUE;
+ /* Get the value of some environment variables and set corresponding globals for performance reasons*/
+ /* If the WIRESHARK_ABORT_ON_DISSECTOR_BUG environment variable is set,
+ * it will call abort(), instead, to make it easier to get a stack trace.
+ */
+ if (getenv("WIRESHARK_ABORT_ON_DISSECTOR_BUG") != NULL) {
+ wireshark_abort_on_dissector_bug = TRUE;
+ } else {
+ wireshark_abort_on_dissector_bug = FALSE;
+ }
+
+ if (getenv("WIRESHARK_ABORT_ON_TOO_MANY_ITEMS") != NULL) {
+ wireshark_abort_on_too_many_items = TRUE;
+ } else {
+ wireshark_abort_on_too_many_items = FALSE;
+ }
+
/*
* proto_init -> register_all_protocols -> g_async_queue_new which
* requires threads to be initialized. This happens automatically with