[php-src] PR #22967: ftp: use SSL_write_ex() in single_send() to fix signed/unsigned handling
| From: | crystarm | Date: | Fri, 31 Jul 2026 10:54:58 +0000 |
| Subject: | [php-src] PR #22967: ftp: use SSL_write_ex() in single_send() to fix signed/unsigned handling | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-37405@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/22967
Author: crystarm
This continues #19912, adding a fix for the outstanding review comment from @ndossche that
hadn't been addressed yet.
The first commit here (by @zeff-ir) replaces
SSL_write() with
SSL_write_ex(), which reports success/failure via its own int return value
while writing the number of bytes sent through a separate size_t* out-parameter —
avoiding the conversion issue entirely and matching the OpenSSL API contract.
The second commit finishes the fix requested in review: single_send() still narrowed
its result to int on return (return (int)sent;), even though it now
computes a size_t (from SSL_write_ex()) or an ssize_t (from
my_send_wrapper_with_restart() in the non-SSL path). Returning ssize_t
instead avoids a theoretical truncation/overflow for writes larger than INT_MAX, which
could otherwise collide with the -1 error sentinel checked by the caller
(my_send()) or corrupt its buffer pointer arithmetic.
In case this PR is accepted, #19912 should be closed.