diff options
author | Stig Bjørlykke <stig@bjorlykke.org> | 2016-03-12 12:46:47 +0100 |
---|---|---|
committer | Stig Bjørlykke <stig@bjorlykke.org> | 2016-03-13 10:20:12 +0000 |
commit | 39c11ce133d6f5201257abe0b937093caf45a5cb (patch) | |
tree | e57568a5b1e9f86ae006e5018d606f28f32c1195 | |
parent | 3c143d28468a68e6c9460c649d075231756de858 (diff) | |
download | wireshark-39c11ce133d6f5201257abe0b937093caf45a5cb.tar.gz wireshark-39c11ce133d6f5201257abe0b937093caf45a5cb.tar.bz2 wireshark-39c11ce133d6f5201257abe0b937093caf45a5cb.zip |
Lua: Check for duplicate heuristic short name
A Proto may be only be registered with a heuristic dissector once,
because we check this in heur_dissector_add().
Change-Id: I524fa832b647d557f13aedcb870f7789058d2180
Reviewed-on: https://code.wireshark.org/review/14436
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
-rw-r--r-- | epan/wslua/wslua_proto.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/epan/wslua/wslua_proto.c b/epan/wslua/wslua_proto.c index e2fe16f5c8..bac94d4f46 100644 --- a/epan/wslua/wslua_proto.c +++ b/epan/wslua/wslua_proto.c @@ -255,6 +255,11 @@ WSLUA_METHOD Proto_register_heuristic(lua_State* L) { return 0; } + /* verify that this is not already registered */ + if (find_heur_dissector_by_unique_short_name(proto->loname)) { + luaL_error(L, "'%s' is already registered as heuristic", proto->loname); + } + /* we'll check if the second form of this function was called: when the second arg is a Dissector obejct. The truth is we don't need the Dissector object to do this form of registration, but someday we might... so we're using it as a boolean arg |