From 4dc79b96ed37ab7a2a59938af2c678678bbec7df Mon Sep 17 00:00:00 2001 From: terrafrost Date: Tue, 14 Jul 2015 19:05:52 -0500 Subject: [PATCH] SSH2: limit the size of data that expect() looks at --- phpseclib/Net/SSH2.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpseclib/Net/SSH2.php b/phpseclib/Net/SSH2.php index cb2ca255..48772f3f 100644 --- a/phpseclib/Net/SSH2.php +++ b/phpseclib/Net/SSH2.php @@ -2670,7 +2670,7 @@ class Net_SSH2 $match = $expect; while (true) { if ($mode == NET_SSH2_READ_REGEX) { - preg_match($expect, $this->interactiveBuffer, $matches); + preg_match($expect, substr($this->interactiveBuffer, -1024), $matches); $match = isset($matches[0]) ? $matches[0] : ''; } $pos = strlen($match) ? strpos($this->interactiveBuffer, $match) : false;