aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--epan/proto.c4
-rw-r--r--epan/value_string.c16
-rw-r--r--epan/value_string.h3
3 files changed, 21 insertions, 2 deletions
diff --git a/epan/proto.c b/epan/proto.c
index 227508ed17..2d451af257 100644
--- a/epan/proto.c
+++ b/epan/proto.c
@@ -6035,6 +6035,10 @@ proto_registrar_dump_values(void)
if (vals) {
if (hfinfo->display & BASE_EXT_STRING) {
value_string_ext *vse_p = (value_string_ext *)hfinfo->strings;
+ if (!value_string_ext_validate(vse_p)) {
+ g_warning("Invalid value_string_ext ptr for: %s", hfinfo->abbrev);
+ continue;
+ }
match_strval_ext(0, vse_p); /* "prime" the extended value_string */
printf("E\t%s\t%d\t%s\t%s\n",
hfinfo->abbrev,
diff --git a/epan/value_string.c b/epan/value_string.c
index 98c36ed6ee..b05fec4bf4 100644
--- a/epan/value_string.c
+++ b/epan/value_string.c
@@ -298,7 +298,19 @@ _match_strval_ext_init(const guint32 val, value_string_ext *vse)
return vse->_vs_match(val, vse);
}
-/* (For use by proto_registrar_dump_values() [See proto.c]) */
+/* (Fcns for use by proto_registrar_dump_values() [See proto.c]) */
+gboolean
+value_string_ext_validate(value_string_ext *vse) {
+ if (vse == NULL)
+ return FALSE;
+ if ((vse->_vs_match == (_value_string_match_t) _match_strval_ext_init) ||
+ (vse->_vs_match == _match_strval_linear) ||
+ (vse->_vs_match == _match_strval_bsearch) ||
+ (vse->_vs_match == _match_strval_index))
+ return TRUE;
+ return FALSE;
+}
+
gchar *
value_string_ext_match_type_str(value_string_ext *vse) {
if (vse->_vs_match == _match_strval_linear)
@@ -307,7 +319,7 @@ value_string_ext_match_type_str(value_string_ext *vse) {
return "[Binary Search]";
if (vse->_vs_match == _match_strval_index)
return "[Direct (indexed) Access]";
- return "[Match Type not initialized]";
+ return "[Match Type not initialized or invalid]";
}
/* ----------- */
diff --git a/epan/value_string.h b/epan/value_string.h
index d78c62337a..e018dc786f 100644
--- a/epan/value_string.h
+++ b/epan/value_string.h
@@ -130,6 +130,9 @@ typedef struct _value_string_ext {
#define VALUE_STRING_EXT_VS_P(x) (x)->_vs_p
#define VALUE_STRING_EXT_VS_NUM_ENTRIES(x) (x)->_vs_num_entries
#define VALUE_STRING_EXT_VS_NAME(x) (x)->_vs_name
+
+/* (Fcns for use by proto_registrar_dump_values() [See proto.c]) */
+gboolean value_string_ext_validate(value_string_ext *vse);
gchar *value_string_ext_match_type_str(value_string_ext *vse);
/* --- --- */