Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

changed strncpy to memcpy #138

Merged
merged 2 commits into from
Aug 16, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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