diff options
author | Luis Ontanon <luis.ontanon@gmail.com> | 2007-03-08 23:00:28 +0000 |
---|---|---|
committer | Luis Ontanon <luis.ontanon@gmail.com> | 2007-03-08 23:00:28 +0000 |
commit | 78028f02b5aa69bb915caeb52be644dfb7877aff (patch) | |
tree | 8d9e1b8898446cb9e5813e43bbc11082654f4723 | |
parent | 7f413f1325cc21bce1e54f350fb722ee1d3b74d8 (diff) |
fix Bug 1370
LUA function all_field_infos() causes wire shark to terminate.
svn path=/trunk/; revision=21004
-rw-r--r-- | epan/wslua/wslua_field.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/epan/wslua/wslua_field.c b/epan/wslua/wslua_field.c index dcccb26c6f..97d6e65211 100644 --- a/epan/wslua/wslua_field.c +++ b/epan/wslua/wslua_field.c @@ -277,10 +277,16 @@ int FieldInfo_register(lua_State* L) { WSLUA_FUNCTION wslua_all_field_infos(lua_State* L) { /* obtain all fields from the current tree */ - GPtrArray* found = lua_tree->tree ? proto_all_finfos(lua_tree->tree) : NULL; + GPtrArray* found; int items_found = 0; guint i; + if (! lua_tree || ! lua_tree->tree ) { + WSLUA_ERROR(wslua_all_field_infos,"Cannot be called outside a listener or dissector"); + } + + found = proto_all_finfos(lua_tree->tree); + if (found) { for (i=0; i<found->len; i++) { pushFieldInfo(L,g_ptr_array_index(found,i)); |