Skip to content

Commit

Permalink
changed strncpy to memcpy (#138)
Browse files Browse the repository at this point in the history
* changed strncpy to memcpy

* Uncrustify
  • Loading branch information
n9wxu authored Aug 16, 2022
1 parent 7fbd7c3 commit 6ab1ff1
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions source/core_http_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -1416,9 +1416,9 @@ 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,
HTTP_RANGE_REQUEST_HEADER_VALUE_PREFIX,
HTTP_RANGE_REQUEST_HEADER_VALUE_PREFIX_LEN );
( void ) memcpy( rangeValueBuffer,
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. */
Expand Down Expand Up @@ -1496,7 +1496,7 @@ static HTTPStatus_t writeRequestLine( HTTPRequestHeaders_t * pRequestHeaders,
if( returnStatus == HTTPSuccess )
{
/* Write "<METHOD> <PATH> 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;
Expand All @@ -1505,23 +1505,23 @@ static HTTPStatus_t writeRequestLine( HTTPRequestHeaders_t * pRequestHeaders,
/* Use "/" as default value if <PATH> is NULL. */
if( ( pPath == NULL ) || ( pathLen == 0U ) )
{
( void ) strncpy( pBufferCur,
HTTP_EMPTY_PATH,
HTTP_EMPTY_PATH_LEN );
( 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,
HTTP_PROTOCOL_VERSION,
HTTP_PROTOCOL_VERSION_LEN );
( void ) memcpy( pBufferCur,
HTTP_PROTOCOL_VERSION,
HTTP_PROTOCOL_VERSION_LEN );
pBufferCur += HTTP_PROTOCOL_VERSION_LEN;

( void ) memcpy( pBufferCur,
Expand Down

0 comments on commit 6ab1ff1

Please sign in to comment.