Skip to content

Commit

Permalink
Use temp buffer to print debug log
Browse files Browse the repository at this point in the history
  • Loading branch information
ActoryOu committed Aug 1, 2023
1 parent 2c62af8 commit 7aaadef
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion source/ota.c
Original file line number Diff line number Diff line change
Expand Up @@ -1817,8 +1817,20 @@ static DocParseErr_t parseJSONbyModel( const char * pJson,
uint16_t paramIndex = 0;
const char * pFileParams = NULL;
uint32_t fileParamsLength = 0;
static char cJsonBuffer[ OTA_MAX_JSON_STR_LEN ];

LogDebug( ( "JSON received: %.*s", messageLength, pJson ) );
if( messageLength < OTA_MAX_JSON_STR_LEN - 1 )
{
memcpy( cJsonBuffer, pJson, messageLength );
cJsonBuffer[ messageLength + 1 ] = 0;
}
else
{
memcpy( cJsonBuffer, pJson, OTA_MAX_JSON_STR_LEN - 2 );
cJsonBuffer[ OTA_MAX_JSON_STR_LEN - 1 ] = 0;
}

LogDebug( ( "JSON received: %s", cJsonBuffer ) );

/* Fetch the model parameters from the DocModel*/
pModelParam = pDocModel->pBodyDef;
Expand Down

0 comments on commit 7aaadef

Please sign in to comment.