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>
This commit is contained in:
Stig Bjørlykke 2016-03-12 12:46:47 +01:00
parent 3c143d2846
commit 39c11ce133
1 changed files with 5 additions and 0 deletions

View File

@ -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