mirror of
https://github.com/espressif/openthread.git
synced 2026-06-06 05:24:51 +00:00
b2093f4f9e
This commit updates `Name::LabelIterator::ReadLabel()` to explicitly check that the read label from the message does not contain any embedded `kNullChar` (`\0`) characters. It uses `StringLength()` to verify that the length of the string matches the expected label length. If a null character is found before the end of the label, `kErrorParse` is returned to prevent potential string truncation issues or misinterpretation of the label name. This broader check replaces a recent fix in `PtrRecord::ReadPtrName()` from #13183 which only verified that the first label was not empty or malformed by checking for a single-character label with a null byte. By enforcing this validation centrally at the `ReadLabel()` level, we now ensure that labels of any length are properly protected against embedded null characters across all DNS record types.