Wireshark-bugs: [Wireshark-bugs] [Bug 9573] Global Variable in x509af dissector causing problems

Date: Wed, 08 Jan 2014 16:07:54 +0000

Comment # 13 on bug 9573 from
(In reply to comment #12)
> (In reply to comment #11)

>I haven't looked at the data parameter
> so I don't know without checking.
> But I made a generic GHashTable in
> pinfo->private_table some time ago to be able to send private attributes
> between Lua plugins, and this can also be used to send attributes between C
> plugins.  I don't know if this is the best solution for this.

When exchanging data between dissectors, you're options are
1. Global variable.  VERY BAD.
2. Add member to packet_info struct.  This penalizes 99% of the other protocols
that will never need that member, so I think it should be discouraged (which is
why I've been slowly trying to remove packet_info struct members that are
dissector specific)
3. Use existing private_data or private_table member.  This assumes that
dissectors between the one assigning the private_data member and the one
reading it aren't going to use the private_data member themselves.  Usually a
safe assumption, but could still be dangerous.
4. Use data parameter of "new style" dissectors.  This puts a specific link
between dissectors and keeps data on the same callstack.  BEST SOLUTION.

ASN.1 dissectors also have their own "context" where 2-3 above could also be
applied.  This is also what makes ASN.1 dissector code hard to follow (at least
for me).

Are CMS and PKCS12 dissectors explicitly (or implicitly through subdissector
table) called by the x509af dissector?  If so, I think the best solution is to
"save" the direct_reference in the ASN.1 context of x509af until the CMS and
PKCS12 dissectors are called.  I'm just not sure if it can be guaranteed to be
"saved" within the ASN.1 context.


You are receiving this mail because:
  • You are watching all bug changes.