Skip to content

Commit

Permalink
Add breaking on empty label
Browse files Browse the repository at this point in the history
  • Loading branch information
ben221199 committed Feb 22, 2025
1 parent 880b8e1 commit 0449cb6
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/Fields/FQDN.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public function serializeToWireFormat(): string{
foreach($this->value AS $label){
$output .= chr(strlen($label)).$label;
}
if($this->value[count($this->value)-1]!==''){
if($this->isRelative()){
$output .= chr(0x40);
}
return $output;
Expand Down Expand Up @@ -92,6 +92,9 @@ public static function deserializeFromWireFormat(string $data): FQDN{
break;
}
$labels[] = substr($data,$i+1,$length);
if($length===0x00){
break;
}
$i += $length;
}
return new self(...$labels);
Expand Down

0 comments on commit 0449cb6

Please sign in to comment.