From 1145d32cb0a017f4ded2851a1d087359cfcc382e Mon Sep 17 00:00:00 2001 From: Neal Jackson Date: Wed, 12 Feb 2020 07:15:41 -0800 Subject: [PATCH] [coap] fix comparison with block size validity check (#4553) --- src/core/coap/coap_message.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/coap/coap_message.cpp b/src/core/coap/coap_message.cpp index ea1e2de68..250872a2e 100644 --- a/src/core/coap/coap_message.cpp +++ b/src/core/coap/coap_message.cpp @@ -193,7 +193,7 @@ otError Message::AppendBlockOption(Message::BlockType aType, uint32_t aNum, bool uint32_t encoded = aSize; VerifyOrExit(aType == kBlockType1 || aType == kBlockType2, error = OT_ERROR_INVALID_ARGS); - VerifyOrExit(aSize < OT_COAP_BLOCK_SIZE_32 || aSize > OT_COAP_BLOCK_SIZE_1024, error = OT_ERROR_INVALID_ARGS); + VerifyOrExit(aSize <= OT_COAP_BLOCK_SIZE_1024, error = OT_ERROR_INVALID_ARGS); VerifyOrExit(aNum < kBlockNumMax, error = OT_ERROR_INVALID_ARGS); encoded |= static_cast(aMore << kBlockMOffset);