mirror of
https://github.com/espressif/openthread.git
synced 2026-07-28 06:37:46 +00:00
[border-agent] check if TLV is valid after reading (#3424)
This commit is contained in:
@@ -203,6 +203,7 @@ void BorderAgent::HandleCoapResponse(void * aContext,
|
||||
StateTlv stateTlv;
|
||||
|
||||
SuccessOrExit(error = Tlv::GetTlv(*message, Tlv::kState, sizeof(stateTlv), stateTlv));
|
||||
VerifyOrExit(stateTlv.IsValid(), error = OT_ERROR_PARSE);
|
||||
|
||||
if (stateTlv.GetState() == StateTlv::kAccept)
|
||||
{
|
||||
@@ -210,6 +211,7 @@ void BorderAgent::HandleCoapResponse(void * aContext,
|
||||
|
||||
SuccessOrExit(error =
|
||||
Tlv::GetTlv(*message, Tlv::kCommissionerSessionId, sizeof(sessionIdTlv), sessionIdTlv));
|
||||
VerifyOrExit(sessionIdTlv.IsValid(), error = OT_ERROR_PARSE);
|
||||
|
||||
netif.GetMle().GetCommissionerAloc(borderAgent.mCommissionerAloc.GetAddress(),
|
||||
sessionIdTlv.GetCommissionerSessionId());
|
||||
|
||||
Reference in New Issue
Block a user