Skip to content

Commit

Permalink
Ensure link can be read before checking it is a directory (#2639)
Browse files Browse the repository at this point in the history
  • Loading branch information
davidgrayston committed May 16, 2020
1 parent 1be851e commit 223b0fe
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/Handler/CurlFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -359,8 +359,14 @@ private function applyHandlerOptions(EasyHandle $easy, array &$conf): void
}
// If it's a directory or a link to a directory use CURLOPT_CAPATH.
// If not, it's probably a file, or a link to a file, so use CURLOPT_CAINFO.
if (\is_dir($options['verify']) ||
(\is_link($options['verify']) && \is_dir(\readlink($options['verify'])))) {
if (
\is_dir($options['verify']) ||
(
\is_link($options['verify']) === true &&
($verifyLink = \readlink($options['verify'])) !== false &&
\is_dir($verifyLink)
)
) {
$conf[CURLOPT_CAPATH] = $options['verify'];
} else {
$conf[CURLOPT_CAINFO] = $options['verify'];
Expand Down

0 comments on commit 223b0fe

Please sign in to comment.