diff --git a/source/core_http_client.c b/source/core_http_client.c index 927028c3..f301fa53 100644 --- a/source/core_http_client.c +++ b/source/core_http_client.c @@ -2103,7 +2103,7 @@ HTTPStatus_t HTTPClient_ReceiveAndParseHttpResponse( const TransportInterface_t { returnStatus = HTTPSuccess; /* There may be dangling data if we parse with do not parse body flag. To let libraries built on top of corehttp we expose it through body. */ - pResponse->bodyLen = totalReceived - ( size_t )( ( ( uintptr_t ) pResponse->pBody ) - ( ( uintptr_t ) pResponse->pBuffer ) ); + pResponse->bodyLen = totalReceived - ( size_t ) ( ( ( uintptr_t ) pResponse->pBody ) - ( ( uintptr_t ) pResponse->pBuffer ) ); } if( returnStatus == HTTPSuccess ) diff --git a/test/cbmc/stubs/HTTPClient_Send_llhttp_execute.c b/test/cbmc/stubs/HTTPClient_Send_llhttp_execute.c index 8f630ba3..f4035b3d 100644 --- a/test/cbmc/stubs/HTTPClient_Send_llhttp_execute.c +++ b/test/cbmc/stubs/HTTPClient_Send_llhttp_execute.c @@ -95,6 +95,7 @@ llhttp_errno_t llhttp_execute( llhttp_t * parser, __CPROVER_assume( bodyOffset < pParsingContext->pResponse->bufferLen ); __CPROVER_assume( bodyOffset < len ); } + pParsingContext->pResponse->pBody = pParsingContext->pBufferCur + bodyOffset; return parser->error;