diff --git a/src/core/coap/coap_message.cpp b/src/core/coap/coap_message.cpp index 5580e0a08..627302535 100644 --- a/src/core/coap/coap_message.cpp +++ b/src/core/coap/coap_message.cpp @@ -268,7 +268,7 @@ const otCoapOption *Message::GetNextOption(void) } else { - ExitNow(); + ExitNow(error = OT_ERROR_PARSE); } VerifyOrExit(optionLength <= GetLength() - GetHelpData().mNextOptionOffset, error = OT_ERROR_PARSE);