Blame SOURCES/avoid-potential-null-deref.patch

03cf90
diff -ur TPM2.0-TSS-1.0/sysapi/sysapi_util/CommandUtil.c TPM2.0-TSS-1.0-new/sysapi/sysapi_util/CommandUtil.c
03cf90
--- TPM2.0-TSS-1.0/sysapi/sysapi_util/CommandUtil.c	2016-11-01 06:53:15.000000000 -0700
03cf90
+++ TPM2.0-TSS-1.0-new/sysapi/sysapi_util/CommandUtil.c	2017-04-03 10:19:11.337348997 -0700
03cf90
@@ -184,13 +184,18 @@
03cf90
 // Common to all _Complete
03cf90
 TSS2_RC CommonComplete( TSS2_SYS_CONTEXT *sysContext )
03cf90
 {
03cf90
-    UINT32 rspSize = CHANGE_ENDIAN_DWORD( ( (TPM20_Header_Out *)( SYS_CONTEXT->tpmOutBuffPtr )  )->responseSize );
03cf90
+    UINT32 rspSize;
03cf90
 
03cf90
     if( sysContext == NULL )
03cf90
     {
03cf90
         return TSS2_SYS_RC_BAD_REFERENCE;
03cf90
     }
03cf90
-    else if( SYS_CONTEXT->previousStage != CMD_STAGE_RECEIVE_RESPONSE || SYS_CONTEXT->rval != TSS2_RC_SUCCESS )
03cf90
+    else
03cf90
+    {
03cf90
+        rspSize = CHANGE_ENDIAN_DWORD( ( (TPM20_Header_Out *)( SYS_CONTEXT->tpmOutBuffPtr )  )->responseSize );
03cf90
+    }
03cf90
+
03cf90
+    if( SYS_CONTEXT->previousStage != CMD_STAGE_RECEIVE_RESPONSE || SYS_CONTEXT->rval != TSS2_RC_SUCCESS )
03cf90
     {
03cf90
         SYS_CONTEXT->rval = TSS2_SYS_RC_BAD_SEQUENCE;
03cf90
     }