diff --git a/src/core/radio/trel_interface.cpp b/src/core/radio/trel_interface.cpp index a1d3ee6b9..7fa190767 100644 --- a/src/core/radio/trel_interface.cpp +++ b/src/core/radio/trel_interface.cpp @@ -262,6 +262,15 @@ Error Interface::ParsePeerInfoTxtData(const Peer::Info &aInfo, while ((error = iterator.GetNextEntry(entry)) == kErrorNone) { + // If the TXT data happens to have entries with key longer + // than `kMaxKeyLength`, `mKey` would be `nullptr` and full + // entry would be placed in `mValue`. We skip over such + // entries. + if (entry.mKey == nullptr) + { + continue; + } + if (strcmp(entry.mKey, kTxtRecordExtAddressKey) == 0) { VerifyOrExit(!parsedExtAddress, error = kErrorParse);