[php-src] master: Merge branch 'PHP-8.0'
| From: | Christoph M. Becker | Date: | Mon, 26 Apr 2021 12:47:25 +0000 |
| Subject: | [php-src] master: Merge branch 'PHP-8.0' | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-115827@lists.php.net to get a copy of this message | ||
Author: Christoph M. Becker (cmb69)
Date: 2021-04-26T14:46:43+02:00
Commit: https://github.com/php/php-src/commit/5d7219dce6c12f75cf0d78937f2d36815b29f7b8
Raw diff: https://github.com/php/php-src/commit/5d7219dce6c12f75cf0d78937f2d36815b29f7b8.diff
Merge branch 'PHP-8.0'
* PHP-8.0:
Fix #80901: Info leak in ftp extension
Changed paths:
A ext/ftp/tests/bug80901.phpt
M ext/ftp/ftp.c
M ext/ftp/tests/server.inc
Diff:
diff --git a/ext/ftp/ftp.c b/ext/ftp/ftp.c
index 50e0ddf2a8e5..a4eec73d4e04 100644
--- a/ext/ftp/ftp.c
+++ b/ext/ftp/ftp.c
@@ -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;
}
/* }}} */
diff --git a/ext/ftp/tests/bug80901.phpt b/ext/ftp/tests/bug80901.phpt
new file mode 100644
index 000000000000..6196bdce9630
--- /dev/null
+++ b/ext/ftp/tests/bug80901.phpt
@@ -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
diff --git a/ext/ftp/tests/server.inc b/ext/ftp/tests/server.inc
index 8bc836fc40e3..19a1231bbc90 100644
--- a/ext/ftp/tests/server.inc
+++ b/ext/ftp/tests/server.inc
@@ -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");
}