[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)
This commit is contained in:
Simon Lin
2020-10-14 12:17:45 -07:00
committed by GitHub
parent 487ec3aa94
commit 946a90520c
+2 -2
View File
@@ -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;