Skip to content

Commit

Permalink
codeql: Fix potential multiplication overflow
Browse files Browse the repository at this point in the history
CodeQL:
> Multiplication result may overflow 'unsigned int' before it is
> converted to 'unsigned long'.
  • Loading branch information
rettichschnidi committed Jan 16, 2022
1 parent d2cb0b1 commit c73b506
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions coap/block.c
Original file line number Diff line number Diff line change
Expand Up @@ -257,8 +257,7 @@ uint8_t prv_coap_block_handler(lwm2m_block_data_t ** pBlockDataHead,
uint8_t * oldBuffer = blockData->blockBuffer;
size_t oldSize = blockData->blockBufferSize;

if (blockData->blockBufferSize != blockSize * blockNum)
{
if (blockData->blockBufferSize != (size_t)blockSize * blockNum) {
// we don't receive block in right order
// TODO should we clean block1 data for this server ?
return COAP_408_REQ_ENTITY_INCOMPLETE;
Expand Down

0 comments on commit c73b506

Please sign in to comment.