[php-src] master: Merge branch 'PHP-7.4' into PHP-8.0

From: Date: Mon, 26 Apr 2021 12:47:23 +0000
Subject: [php-src] master: Merge branch 'PHP-7.4' into PHP-8.0
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-115826@lists.php.net to get a copy of this message
Author: Christoph M. Becker (cmb69) Date: 2021-04-26T14:45:55+02:00 Commit: https://github.com/php/php-src/commit/33d49551d1c05f49c9a837ff6d47f19bc711feb2 Raw diff: https://github.com/php/php-src/commit/33d49551d1c05f49c9a837ff6d47f19bc711feb2.diff Merge branch 'PHP-7.4' into PHP-8.0 * PHP-7.4: Fix #80901: Info leak in ftp extension Changed paths: A ext/ftp/tests/bug80901.phpt M NEWS M ext/ftp/ftp.c M ext/ftp/tests/server.inc Diff: diff --git a/NEWS b/NEWS index a9896da34fd1..73f95ad5326a 100644 --- a/NEWS +++ b/NEWS @@ -9,6 +9,9 @@ PHP NEWS (cmb) . Fixed bug Bug #80972 (Memory exhaustion on invalid string offset). (girgias) +- FTP: + . Fixed bug #80901 (Info leak in ftp extension). (cmb) + - pgsql: . Fixed php_pgsql_fd_cast() wrt. php_stream_can_cast(). (cmb) diff --git a/ext/ftp/ftp.c b/ext/ftp/ftp.c index dfe2ae86a845..215e0443cfc6 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 38599391d616..93c6e94778ce 100644 --- a/ext/ftp/tests/server.inc +++ b/ext/ftp/tests/server.inc @@ -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; } @@ -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"); }

« previous php.cvs (#115826) next »