Skip to content

Fix #80901: Info leak in ftp extension #6894

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions ext/ftp/ftp.c
Original file line number Diff line number Diff line change
Expand Up @@ -1349,10 +1349,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;
}
/* }}} */
Expand Down
22 changes: 22 additions & 0 deletions ext/ftp/tests/bug80901.phpt
Original file line number Diff line number Diff line change
@@ -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
3 changes: 3 additions & 0 deletions ext/ftp/tests/server.inc
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,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;
}
Expand Down Expand Up @@ -197,6 +198,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");
}
Expand Down