Skip to content

Commit

Permalink
Fix: Filter out empty IP addresses in dnsResolve method
Browse files Browse the repository at this point in the history
This commit resolves an issue where empty IP addresses could be returned by the dnsResolve method due to CNAME recursion. The fix filters out empty IP addresses before returning the result, ensuring that only valid, non-empty IP addresses are used in the addDnsPinning method.

Signed-off-by: Robin Winkelewski <[email protected]>
  • Loading branch information
w9n committed Apr 18, 2023
1 parent 66ab45b commit a67f7a3
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/private/Http/Client/DnsPinMiddleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,10 @@ private function dnsResolve(string $target, int $recursionCount) : array {
}
}

return $targetIps;
// Filter out empty IP addresses before returning the result
return array_filter($targetIps, function($ip) {
return !empty($ip);
});
}

public function addDnsPinning() {
Expand Down

0 comments on commit a67f7a3

Please sign in to comment.