Skip to content

Commit

Permalink
Fix gcc FORTIFY_SOURCE warnings in core_http_client.c.
Browse files Browse the repository at this point in the history
  • Loading branch information
paulbartell committed Apr 29, 2021
1 parent 3908d64 commit c3d41a5
Showing 1 changed file with 18 additions and 18 deletions.
36 changes: 18 additions & 18 deletions source/core_http_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -1340,9 +1340,9 @@ static HTTPStatus_t addHeader( HTTPRequestHeaders_t * pRequestHeaders,
pBufferCur += fieldLen;

/* Copy the field separator, ": ", into the buffer. */
( void ) strncpy( pBufferCur,
HTTP_HEADER_FIELD_SEPARATOR,
HTTP_HEADER_FIELD_SEPARATOR_LEN );
( void ) memcpy( pBufferCur,
HTTP_HEADER_FIELD_SEPARATOR,
HTTP_HEADER_FIELD_SEPARATOR_LEN );

pBufferCur += HTTP_HEADER_FIELD_SEPARATOR_LEN;

Expand All @@ -1358,9 +1358,9 @@ static HTTPStatus_t addHeader( HTTPRequestHeaders_t * pRequestHeaders,
pBufferCur += valueLen;

/* Copy the header end indicator, "\r\n\r\n" into the buffer. */
( void ) strncpy( pBufferCur,
HTTP_HEADER_END_INDICATOR,
HTTP_HEADER_END_INDICATOR_LEN );
( void ) memcpy( pBufferCur,
HTTP_HEADER_END_INDICATOR,
HTTP_HEADER_END_INDICATOR_LEN );

/* Update the headers length value only when everything is successful. */
pRequestHeaders->headersLen = backtrackHeaderLen + toAddLen;
Expand Down Expand Up @@ -1399,9 +1399,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 @@ -1488,9 +1488,9 @@ 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
Expand All @@ -1502,14 +1502,14 @@ static HTTPStatus_t writeRequestLine( HTTPRequestHeaders_t * pRequestHeaders,
*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 ) strncpy( pBufferCur,
HTTP_HEADER_LINE_SEPARATOR,
HTTP_HEADER_LINE_SEPARATOR_LEN );
( void ) memcpy( pBufferCur,
HTTP_HEADER_LINE_SEPARATOR,
HTTP_HEADER_LINE_SEPARATOR_LEN );
pRequestHeaders->headersLen = toAddLen;
}

Expand Down

0 comments on commit c3d41a5

Please sign in to comment.