[border-agent] check if TLV is valid after reading (#3424)

This commit is contained in:
Jonathan Hui
2019-01-03 09:16:54 -08:00
committed by GitHub
parent 0e42d0b8c9
commit 0cd21d8d3f
+2
View File
@@ -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());