[php-src] PR #22328: ext/ftp: fix out-of-bounds read in ftp_get() ASCII CRLF translation
| From: | iliaal | Date: | Tue, 16 Jun 2026 01:34:46 +0000 |
| Subject: | [php-src] PR #22328: ext/ftp: fix out-of-bounds read in ftp_get() ASCII CRLF translation | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-36452@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/22328
Author: iliaal
In ASCII mode ftp_get() peeks at the byte after each '\r' to fold CRLF into LF. When that
'\r' is the last byte of a full FTP_BUFSIZE read, the lookahead reads one byte past the
buffer; a server placing '\r' at offset 4095 of a 4096-byte read hits it (ASAN:
heap-buffer-overflow read of size 1). Bound the lookahead to the received data, as ftp_readline()
does. ftp_nb_continue_read() carries the trailing '\r' across reads and isn't
affected.