Avoid UAF after deregister_dissector
authorPeter Wu <peter@lekensteyn.nl>
Thu, 31 Mar 2016 19:53:05 +0000 (21:53 +0200)
committerMichael Mann <mmann78@netscape.net>
Sat, 2 Apr 2016 23:00:00 +0000 (23:00 +0000)
commita14e7a7ce19ea2cd0799ebca43d9eaf00aabb27d
tree3c4ae306864af2371107cbd199883a1cfcacae26
parent07f4258a5033751768f6f546997c77cfdbdfa95f
Avoid UAF after deregister_dissector

When deregister_dissector is called by Lua, the protocol was not
property removed from the dependent dissectors list. Fix this and also
duplicate the memory for keys and values since these strings might be
dynamically allocated.

Fixes a use-after-free after reloading Lua dissectors that use
DissectorTable:add() and opening a new/closing an existing capture file.

Change-Id: If2ae02f155e7ab8fc653c08003755897471f9be0
Reviewed-on: https://code.wireshark.org/review/14735
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
epan/packet.c