mirror of
https://github.com/espressif/openthread.git
synced 2026-08-23 02:39:52 +00:00
[trel] relax parsing of TXT data entries to allow extra bytes (#11470)
This commit relaxes the parsing of TREL TXT data entries to allow extra bytes to be present at the end of a value. Currently, these extra bytes are simply ignored. This change provides safer forward compatibility, allowing for future additions to the format of the TXT data entries.
This commit is contained in:
@@ -269,14 +269,14 @@ Error Interface::ParsePeerInfoTxtData(const Peer::Info &aInfo,
|
||||
if (StringMatch(entry.mKey, kTxtRecordExtAddressKey))
|
||||
{
|
||||
VerifyOrExit(!parsedExtAddress, error = kErrorParse);
|
||||
VerifyOrExit(entry.mValueLength == sizeof(Mac::ExtAddress), error = kErrorParse);
|
||||
VerifyOrExit(entry.mValueLength >= sizeof(Mac::ExtAddress), error = kErrorParse);
|
||||
aExtAddress.Set(entry.mValue);
|
||||
parsedExtAddress = true;
|
||||
}
|
||||
else if (StringMatch(entry.mKey, kTxtRecordExtPanIdKey))
|
||||
{
|
||||
VerifyOrExit(!parsedExtPanId, error = kErrorParse);
|
||||
VerifyOrExit(entry.mValueLength == sizeof(MeshCoP::ExtendedPanId), error = kErrorParse);
|
||||
VerifyOrExit(entry.mValueLength >= sizeof(MeshCoP::ExtendedPanId), error = kErrorParse);
|
||||
memcpy(aExtPanId.m8, entry.mValue, sizeof(MeshCoP::ExtendedPanId));
|
||||
parsedExtPanId = true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user