Skip to content

Commit 6de0a8c

Browse files
committed
SCA: constant time string starts with check
1 parent 0ffd0c6 commit 6de0a8c

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/Io/RequestHeaderParser.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,10 @@ private function parseRequest($headers)
7070
// parser does not support asterisk-form and authority-form
7171
// remember original target and temporarily replace and re-apply below
7272
$originalTarget = null;
73-
if (strpos($headers, 'OPTIONS * ') === 0) {
73+
if (strncmp($headers, 'OPTIONS * ', 10) === 0) {
7474
$originalTarget = '*';
7575
$headers = 'OPTIONS / ' . substr($headers, 10);
76-
} elseif (strpos($headers, 'CONNECT ') === 0) {
76+
} elseif (strncmp($headers, 'CONNECT ', 8) === 0) {
7777
$parts = explode(' ', $headers, 3);
7878
$uri = parse_url('tcp://' . $parts[1]);
7979

0 commit comments

Comments
 (0)