Commit 5be2d776 authored by Jaewook Jung's avatar Jaewook Jung Committed by Ashok Babu Channa

Fix a defect detected by static code analyzer

unsigned int is always greater than or equal to zero.

Change-Id: I2aa83c4a224e5bbaf22882ccb131161850dcee57
Signed-off-by: default avatarJaewook Jung <jw0213.jung@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/18879Tested-by: default avatarjenkins-iotivity <jenkins@iotivity.org>
Reviewed-by: default avatarJaehong Jo <jaehong.jo@samsung.com>
Reviewed-by: default avatarDan Mihai <Daniel.Mihai@microsoft.com>
Reviewed-by: default avatarAshok Babu Channa <ashok.channa@samsung.com>
parent d1a8296b
......@@ -1923,7 +1923,7 @@ uint8_t CACheckBlockErrorType(CABlockData_t *currData, coap_block_t *receivedBlo
OIC_LOG(ERROR, TAG, "too large size");
// set the block size to be smaller than COAP_MAX_PDU_SIZE
for (unsigned int size = CA_DEFAULT_BLOCK_SIZE; size >= 0; size--)
for (unsigned int size = CA_DEFAULT_BLOCK_SIZE; ; size--)
{
if (COAP_MAX_PDU_SIZE >= (size_t)BLOCK_SIZE(size) + optionLen)
{
......@@ -1932,6 +1932,10 @@ uint8_t CACheckBlockErrorType(CABlockData_t *currData, coap_block_t *receivedBlo
currData->block1.szx = size;
break;
}
if (0 == size)
{
break;
}
}
return CA_BLOCK_TOO_LARGE;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment