From 946a90520cb9b30366fe882d73508854a3f65914 Mon Sep 17 00:00:00 2001 From: Simon Lin Date: Thu, 15 Oct 2020 03:17:45 +0800 Subject: [PATCH] [coap] allow max URI path length (#5645) - allow max URI path length of 32 - change error to OT_ERROR_PARSE (used to be OT_ERROR_NOT_FOUND) --- src/core/coap/coap.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core/coap/coap.cpp b/src/core/coap/coap.cpp index 80988064d..a8556de99 100644 --- a/src/core/coap/coap.cpp +++ b/src/core/coap/coap.cpp @@ -666,7 +666,7 @@ exit: void CoapBase::ProcessReceivedRequest(Message &aMessage, const Ip6::MessageInfo &aMessageInfo) { - char uriPath[Resource::kMaxReceivedUriPath]; + char uriPath[Resource::kMaxReceivedUriPath + 1]; char * curUriPath = uriPath; Message * cachedResponse = nullptr; otError error = OT_ERROR_NOT_FOUND; @@ -704,7 +704,7 @@ void CoapBase::ProcessReceivedRequest(Message &aMessage, const Ip6::MessageInfo *curUriPath++ = '/'; } - VerifyOrExit(curUriPath + optionLength < OT_ARRAY_END(uriPath), OT_NOOP); + VerifyOrExit(curUriPath + optionLength < OT_ARRAY_END(uriPath), error = OT_ERROR_PARSE); IgnoreError(iterator.ReadOptionValue(curUriPath)); curUriPath += optionLength;