[php-src] PR #22364: ext/ftp: preserve bare CR bytes in ftp_get() ASCII mode
| From: | iliaal | Date: | Thu, 18 Jun 2026 23:52:09 +0000 |
| Subject: | [php-src] PR #22364: ext/ftp: preserve bare CR bytes in ftp_get() ASCII mode | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-36504@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/22364
Author: iliaal
In ASCII mode
ftp_get() stripped every \r and re-emitted only a following
\n, dropping bare CRs that aren't part of a CRLF (ba\rre arrived as
bare). It now folds CRLF to LF but writes a lone \r through unchanged,
carries a \r landing on the last byte of a read into the next read, and flushes it at
EOF, so the boundary case matches the in-buffer case. ftp_nb_get() already did this via
the lastch carry in ftp_nb_continue_read(). Follow-up to GH-22328, which
fixed the out-of-bounds read in the same lookahead.