Wireshark-dev: Re: [Wireshark-dev] r42853: Add a null check to fix Coverity CID 280210 (packet-
From: Christopher Maynard <[email protected]>
Date: Mon, 28 May 2012 17:06:39 +0000 (UTC)
Jakub Zawadzki <[email protected]> writes:

> Can someone look at r42853[1]?
> I don't have access to coverity scans, and I really don't know what 
> CID 280210 means,
> but this commit looks strange for me.

You should be able to get access if you want it.  Here's the relevant question
in their FAQ regarding accounts:
http://scan.coverity.com/developers-faq.html#get-account.  When I got access, I
just sent a request to Coverity, but maybe now Gerald has to approve?  Or maybe
Gerald did approve and I just didn't realize it. 

> get_tpt_conversation(pinfo, TRUE); always returns some not-null pointer,
> which results in dead code after patch.
> 
> And it still pass tpt_conversation to conversation_get_proto_data,
> which would sigsegv with NULL conversation.
> 
> Maybe CID 280210 is about 'tpt_conv_data' variable?
> 
> [1]
http://anonsvn.wireshark.org/viewvc/trunk/epan/dissectors/packet-jxta.c?r1=42853&r2=42852&pathrev=42853


I think you're right.  Here's the relevant Coverity information:

537        tpt_conversation = get_tpt_conversation(pinfo, TRUE);
CID 280210: Dereference null return value (NULL_RETURNS)Function
"conversation_get_proto_data" returns null (checked 115 out of 131 times). 
[show details]
Assigning: "tpt_conv_data" = null return value from 
"conversation_get_proto_data".
 538        tpt_conv_data = (jxta_stream_conversation_data *)
conversation_get_proto_data(tpt_conversation, proto_jxta);
 539
Dereferencing a null pointer "tpt_conv_data".
 540        if (0 == tpt_conv_data->initiator_welcome_frame) {