aboutsummaryrefslogtreecommitdiffstats
path: root/epan/wslua
diff options
context:
space:
mode:
authorStig Bjørlykke <stig@bjorlykke.org>2016-03-12 12:46:47 +0100
committerStig Bjørlykke <stig@bjorlykke.org>2016-03-13 10:20:12 +0000
commit39c11ce133d6f5201257abe0b937093caf45a5cb (patch)
treee57568a5b1e9f86ae006e5018d606f28f32c1195 /epan/wslua
parent3c143d28468a68e6c9460c649d075231756de858 (diff)
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>
Diffstat (limited to 'epan/wslua')
-rw-r--r--epan/wslua/wslua_proto.c5
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