Skip to content

Commit

Permalink
test fix for blank (len 1) TXT records breaking next read
Browse files Browse the repository at this point in the history
  • Loading branch information
purplepixie committed May 27, 2024
1 parent 882b742 commit 18cd3a4
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/PurplePixie/PhpDns/DNSQuery.php
Original file line number Diff line number Diff line change
Expand Up @@ -309,11 +309,16 @@ private function readRecord(): array

case DNSTypes::ID_TXT:
case DNSTypes::ID_SPF:
$data="";
for ($string_count = 0; strlen($data) + (1 + $string_count) < $ans_header['length']; $string_count++) {
$string_length = ord($this->readResponse(1));
$data .= $this->readResponse($string_length);
}

// test for TXT fix - skips the responsecounter ahead one in the event of a blank (len 1) TXT record
if ($ans_header['length']==1)
$this->responsecounter++;

$string = $domain . ' TEXT "' . $data . '" (in ' . $string_count . ' strings)';
break;

Expand Down

0 comments on commit 18cd3a4

Please sign in to comment.