diff options
author | Bill Meier <wmeier@newsguy.com> | 2010-11-14 16:30:56 +0000 |
---|---|---|
committer | Bill Meier <wmeier@newsguy.com> | 2010-11-14 16:30:56 +0000 |
commit | a7063f9cc8e585afaaab8d8729ebb31b27459267 (patch) | |
tree | db09a896ad0d4286ff1e12fbc2b4873a5a2772a6 /epan/value_string.c | |
parent | 484da51294f611555bd58ff6cd08814c8a9c37c3 (diff) |
'tshark -G values' - Validate (somewhat) value_string_ext before use to prevent a crash.
svn path=/trunk/; revision=34869
Diffstat (limited to 'epan/value_string.c')
-rw-r--r-- | epan/value_string.c | 16 |
1 files changed, 14 insertions, 2 deletions
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]"; } /* ----------- */ |