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