mirror of
https://github.com/espressif/openthread.git
synced 2026-08-23 02:39:52 +00:00
[meshcop] enforce max length on commissioner id (#4178)
This commit is contained in:
@@ -107,6 +107,11 @@ void Leader::HandlePetition(Coap::Message &aMessage, const Ip6::MessageInfo &aMe
|
||||
|
||||
mCommissionerId = commissionerId;
|
||||
|
||||
if (mCommissionerId.GetLength() > CommissionerIdTlv::kMaxLength)
|
||||
{
|
||||
mCommissionerId.SetLength(CommissionerIdTlv::kMaxLength);
|
||||
}
|
||||
|
||||
state = StateTlv::kAccept;
|
||||
mTimer.Start(TimerMilli::SecToMsec(kTimeoutLeaderPetition));
|
||||
|
||||
|
||||
@@ -824,6 +824,11 @@ OT_TOOL_PACKED_BEGIN
|
||||
class CommissionerIdTlv : public Tlv
|
||||
{
|
||||
public:
|
||||
enum
|
||||
{
|
||||
kMaxLength = 64, ///< maximum length (bytes)
|
||||
};
|
||||
|
||||
/**
|
||||
* This method initializes the TLV.
|
||||
*
|
||||
@@ -867,11 +872,6 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
enum
|
||||
{
|
||||
kMaxLength = 64,
|
||||
};
|
||||
|
||||
char mCommissionerId[kMaxLength];
|
||||
} OT_TOOL_PACKED_END;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user