Refs #1305, #1306. Corrected max DTO and max CTO usage.

git-svn-id: https://svn.code.sf.net/p/openblt/code/trunk@892 5dc33758-31d5-4daf-9ae8-b24bf3d40d73
This commit is contained in:
Frank Voorburg 2021-08-18 13:37:42 +00:00
parent cab852ee9e
commit f346ba9546
3 changed files with 6 additions and 6 deletions

View File

@ -401,7 +401,7 @@ static bool XcpLoaderStart(void)
{
keyCurrentLen = (xcpMaxCto - 2);
}
/* The the (possible partial) unlock command. */
/* Send the (possible partial) unlock command. */
if (!XcpLoaderSendCmdUnlock(keyPtr, keyRemainingLen, &currentlyProtectedResources))
{
result = false;
@ -921,7 +921,7 @@ static bool XcpLoaderSendCmdGetSeed(uint8_t resource, uint8_t mode, uint8_t * se
if (result)
{
/* Check if the response was valid. */
if ( (resPacket.len <= 2) || (resPacket.len > xcpMaxCto) ||
if ( (resPacket.len <= 2) || (resPacket.len > xcpMaxDto) ||
(resPacket.data[0] != XCPLOADER_CMD_PID_RES) )
{
/* Not a valid or positive response. */
@ -935,9 +935,9 @@ static bool XcpLoaderSendCmdGetSeed(uint8_t resource, uint8_t mode, uint8_t * se
*seedLen = resPacket.data[1];
/* Determine the number of seed bytes in the current response */
currentSeedLen = *seedLen;
if (currentSeedLen > (xcpMaxCto - 2))
if (currentSeedLen > ((uint8_t)xcpMaxDto - 2))
{
currentSeedLen = (xcpMaxCto - 2);
currentSeedLen = ((uint8_t)xcpMaxDto - 2);
}
/* Store the seed bytes. */
for (uint8_t idx = 0; idx < currentSeedLen; idx++)

Binary file not shown.

View File

@ -1012,9 +1012,9 @@ static void XcpCmdGetSeed(blt_int8u *data)
}
/* determine number of seed bytes that fit in the first response */
seedCurrentLen = seedRemainderLen;
if (seedCurrentLen > (XCP_CTO_PACKET_LEN-2))
if (seedCurrentLen > (XCP_DTO_PACKET_LEN-2))
{
seedCurrentLen = XCP_CTO_PACKET_LEN-2;
seedCurrentLen = XCP_DTO_PACKET_LEN-2;
}
/* store the first part of the seed in the response */
CpuMemCopy((blt_addr)(&xcpInfo.ctoData[2]), (blt_addr)seedCurrentPtr, seedCurrentLen);