From 36cd7b5a8ed1e4616e0be7e3738767ef687ae965 Mon Sep 17 00:00:00 2001 From: Sam Feyaerts Date: Thu, 20 Feb 2025 14:56:19 +0100 Subject: [PATCH] feat: support multi-string txt records in raw data responses --- src/Handlers/Raw/RawDataResponse.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/Handlers/Raw/RawDataResponse.php b/src/Handlers/Raw/RawDataResponse.php index 9bdc513..04c4312 100644 --- a/src/Handlers/Raw/RawDataResponse.php +++ b/src/Handlers/Raw/RawDataResponse.php @@ -215,8 +215,13 @@ function readRecord(): array break; case RecordTypes::TXT: - $strLen = ord($this->readResponse()); - $text = $this->readResponse($strLen); + $totalLength = $headerData['length']; + $text = ''; + do { + $totalLength--; + $strLen = ord($this->readResponse()); + $text .= $this->readResponse($strLen); + } while (strlen($text) < $totalLength); $result['txt'] = DnsUtils::sanitizeRecordTxt($text); break;