Merge branch 'PHP-8.0'

* PHP-8.0:
  Fix #80901: Info leak in ftp extension
This commit is contained in:
Christoph M. Becker 2021-04-26 14:46:43 +02:00
commit 5d7219dce6
No known key found for this signature in database
GPG Key ID: D66C9593118BCCB6
3 changed files with 27 additions and 0 deletions

View File

@ -1313,10 +1313,12 @@ ftp_readline(ftpbuf_t *ftp)
data = eol;
if ((rcvd = my_recv(ftp, ftp->fd, data, size)) < 1) {
*data = 0;
return 0;
}
} while (size);
*data = 0;
return 0;
}
/* }}} */

View File

@ -0,0 +1,22 @@
--TEST--
Bug #80901 (Info leak in ftp extension)
--SKIPIF--
<?php
require 'skipif.inc';
?>
--INI--
log_errors_max_len=0
--FILE--
<?php
$bug80901 = true;
require 'server.inc';
$ftp = ftp_connect("127.0.0.1", $port);
if (!$ftp) die("Couldn't connect to the server");
var_dump(ftp_login($ftp, 'user', 'pass'));
ftp_systype($ftp);
?>
--EXPECTF--
bool(true)
Warning: ftp_systype(): **************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************** in %s on line %d

View File

@ -73,6 +73,7 @@ if ($pid) {
fputs($s, "234 auth type accepted\r\n");
} else {
fputs($s, "666 dummy\r\n");
sleep(1);
fputs($s, "666 bogus msg\r\n");
exit;
}
@ -161,6 +162,8 @@ if ($pid) {
} elseif ($buf === "SYST\r\n") {
if (isset($bug27809)) {
fputs($s, "215 OS/400 is the remote operating system. The TCP/IP version is \"V5R2M0\"\r\n");
} elseif (isset($bug80901)) {
fputs($s, "\r\n" . str_repeat("*", 4096) . "\r\n");
} else {
fputs($s, "215 UNIX Type: L8.\r\n");
}