SSH2: replace user_error with Exceptions

This commit is contained in:
terrafrost 2024-11-22 18:00:43 -06:00
parent f5113e1352
commit b66b5dc6b2

View File

@ -3730,18 +3730,18 @@ class SSH2
$cmf = ord($payload[0]);
$cm = $cmf & 0x0F;
if ($cm != 8) { // deflate
user_error("Only CM = 8 ('deflate') is supported ($cm)");
throw new \RuntimeException("Only CM = 8 ('deflate') is supported ($cm)");
}
$cinfo = ($cmf & 0xF0) >> 4;
if ($cinfo > 7) {
user_error("CINFO above 7 is not allowed ($cinfo)");
throw new \RuntimeException("CINFO above 7 is not allowed ($cinfo)");
}
$windowSize = 1 << ($cinfo + 8);
$flg = ord($payload[1]);
//$fcheck = $flg && 0x0F;
if ((($cmf << 8) | $flg) % 31) {
user_error('fcheck failed');
throw new \RuntimeException('fcheck failed');
}
$fdict = boolval($flg & 0x20);
$flevel = ($flg & 0xC0) >> 6;