From 100071801a2c7279a29e55b329bbfac9fa1899eb Mon Sep 17 00:00:00 2001 From: Joseph Julicher Date: Mon, 15 Aug 2022 15:35:08 -0700 Subject: [PATCH 1/2] changed strncpy to memcpy --- source/core_http_client.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/source/core_http_client.c b/source/core_http_client.c index 9bcfdf3e..3cbc79e8 100644 --- a/source/core_http_client.c +++ b/source/core_http_client.c @@ -1416,7 +1416,7 @@ static HTTPStatus_t addRangeHeader( HTTPRequestHeaders_t * pRequestHeaders, /* Generate the value data for the Range Request header.*/ /* Write the range value prefix in the buffer. */ - ( void ) strncpy( rangeValueBuffer, + ( void ) memcpy( rangeValueBuffer, HTTP_RANGE_REQUEST_HEADER_VALUE_PREFIX, HTTP_RANGE_REQUEST_HEADER_VALUE_PREFIX_LEN ); rangeValueLength += HTTP_RANGE_REQUEST_HEADER_VALUE_PREFIX_LEN; @@ -1496,7 +1496,7 @@ static HTTPStatus_t writeRequestLine( HTTPRequestHeaders_t * pRequestHeaders, if( returnStatus == HTTPSuccess ) { /* Write " HTTP/1.1\r\n" to start the HTTP header. */ - ( void ) strncpy( pBufferCur, pMethod, methodLen ); + ( void ) memcpy( pBufferCur, pMethod, methodLen ); pBufferCur += methodLen; *pBufferCur = SPACE_CHARACTER; @@ -1505,21 +1505,21 @@ static HTTPStatus_t writeRequestLine( HTTPRequestHeaders_t * pRequestHeaders, /* Use "/" as default value if is NULL. */ if( ( pPath == NULL ) || ( pathLen == 0U ) ) { - ( void ) strncpy( pBufferCur, + ( void ) memcpy( pBufferCur, HTTP_EMPTY_PATH, HTTP_EMPTY_PATH_LEN ); pBufferCur += HTTP_EMPTY_PATH_LEN; } else { - ( void ) strncpy( pBufferCur, pPath, pathLen ); + ( void ) memcpy( pBufferCur, pPath, pathLen ); pBufferCur += pathLen; } *pBufferCur = SPACE_CHARACTER; pBufferCur += SPACE_CHARACTER_LEN; - ( void ) strncpy( pBufferCur, + ( void ) memcpy( pBufferCur, HTTP_PROTOCOL_VERSION, HTTP_PROTOCOL_VERSION_LEN ); pBufferCur += HTTP_PROTOCOL_VERSION_LEN; From 57adb55740774821abb595abd2ef6f11cc1914a2 Mon Sep 17 00:00:00 2001 From: Joseph Julicher Date: Mon, 15 Aug 2022 15:46:07 -0700 Subject: [PATCH 2/2] Uncrustify --- source/core_http_client.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/source/core_http_client.c b/source/core_http_client.c index 3cbc79e8..17a23df0 100644 --- a/source/core_http_client.c +++ b/source/core_http_client.c @@ -1417,8 +1417,8 @@ static HTTPStatus_t addRangeHeader( HTTPRequestHeaders_t * pRequestHeaders, /* Write the range value prefix in the buffer. */ ( void ) memcpy( rangeValueBuffer, - HTTP_RANGE_REQUEST_HEADER_VALUE_PREFIX, - HTTP_RANGE_REQUEST_HEADER_VALUE_PREFIX_LEN ); + HTTP_RANGE_REQUEST_HEADER_VALUE_PREFIX, + HTTP_RANGE_REQUEST_HEADER_VALUE_PREFIX_LEN ); rangeValueLength += HTTP_RANGE_REQUEST_HEADER_VALUE_PREFIX_LEN; /* Write the range start value in the buffer. */ @@ -1506,8 +1506,8 @@ static HTTPStatus_t writeRequestLine( HTTPRequestHeaders_t * pRequestHeaders, if( ( pPath == NULL ) || ( pathLen == 0U ) ) { ( void ) memcpy( pBufferCur, - HTTP_EMPTY_PATH, - HTTP_EMPTY_PATH_LEN ); + HTTP_EMPTY_PATH, + HTTP_EMPTY_PATH_LEN ); pBufferCur += HTTP_EMPTY_PATH_LEN; } else @@ -1520,8 +1520,8 @@ static HTTPStatus_t writeRequestLine( HTTPRequestHeaders_t * pRequestHeaders, pBufferCur += SPACE_CHARACTER_LEN; ( void ) memcpy( pBufferCur, - HTTP_PROTOCOL_VERSION, - HTTP_PROTOCOL_VERSION_LEN ); + HTTP_PROTOCOL_VERSION, + HTTP_PROTOCOL_VERSION_LEN ); pBufferCur += HTTP_PROTOCOL_VERSION_LEN; ( void ) memcpy( pBufferCur,