From dc5061d565118c47c6a3cb77dafbdf1e1be9c956 Mon Sep 17 00:00:00 2001 From: Ubuntu Date: Mon, 4 Mar 2024 06:59:13 +0000 Subject: [PATCH] Add assertion to ensure pBufCur points to the same array --- source/sigv4.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/source/sigv4.c b/source/sigv4.c index 3569c549..d76df7e3 100644 --- a/source/sigv4.c +++ b/source/sigv4.c @@ -3293,6 +3293,8 @@ SigV4Status_t SigV4_GenerateHTTPAuthorization( const SigV4Parameters_t * pParams * Note that the StringToSign starts from the beginning of the processing buffer. */ if( returnStatus == SigV4Success ) { + assert( canonicalContext.pBufCur >= ( char * ) ( canonicalContext.pBufProcessing ) ); + assert( canonicalContext.pBufCur <= ( char * ) ( &( canonicalContext.pBufProcessing[ SIGV4_PROCESSING_BUFFER_LENGTH - 1 ] ) ) ); /* MISRA Ref 18.2.1 [Pointer subtraction within array] */ /* More details at: https://github.com/aws/SigV4-for-AWS-IoT-embedded-sdk/blob/main/MISRA.md#rule-182 */ /* coverity[misra_c_2012_rule_18_2_violation] */