Disclaimer:
I could not complie-test or runtime-test these patches right now. This is a 
pure code-only review of the patches.

If toKill was actually NULL, you'd already die on line 
125:            previous->next = toKill->next;
If get_context() or get_previous_context() can actually return NULL, I'd add a 
return ERROR; right after those two functions.
Otherwise, I guess coverity is just not intelligent enough. Still, a NULL-check 
at the beginning right after the two getters is more logical (even if it's only 
for coverity).


Am Mittwoch, den 09.04.2014, 15:41 -0300 schrieb [email protected]:
> From: Richard Maciel <[email protected]>
> 
> Related to coverity CID 10304.
> 
> There was a possible code execution path, in function context_destroy
> that have toKill pointer var with the NULL value.
> 
> Signed-off-by: Richard Maciel <[email protected]>
> ---
>  src/tcs/tcs_context.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/tcs/tcs_context.c b/src/tcs/tcs_context.c
> index 905567b..2072bdc 100644
> --- a/src/tcs/tcs_context.c
> +++ b/src/tcs/tcs_context.c
> @@ -134,7 +134,7 @@ destroy_context(TCS_CONTEXT_HANDLE handle)
>  
>  #ifdef TSS_BUILD_TRANSPORT
>       /* Free existing transport session if necessary */
> -     if (toKill->transHandle)
> +     if (toKill != NULL && toKill->transHandle)
>               TCSP_FlushSpecific_Common(toKill->transHandle, TPM_RT_TRANS);
>  #endif
>  

------------------------------------------------------------------------------
Put Bad Developers to Shame
Dominate Development with Jenkins Continuous Integration
Continuously Automate Build, Test & Deployment 
Start a new project now. Try Jenkins in the cloud.
http://p.sf.net/sfu/13600_Cloudbees
_______________________________________________
TrouSerS-tech mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/trousers-tech

Reply via email to