Skip to content

Commit db286fe

Browse files
committed
ftp: use int for sent to preserve SSL_write()
SSL_write() returns int and uses negative values to indicate errors. The variable sent, which stores the result of SSL_write(), was declared as size_t, causing negative values to be converted into large positive values. Although the value is later converted back when passed to SSL_get_error, using int makes the code cleaner and more consistent with the SSL_write() contract.
1 parent 4bc060c commit db286fe

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

ext/ftp/ftp.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1320,7 +1320,7 @@ static int single_send(ftpbuf_t *ftp, php_socket_t s, void *buf, size_t size) {
13201320
bool retry = 0;
13211321
SSL *handle = NULL;
13221322
php_socket_t fd;
1323-
size_t sent;
1323+
int sent;
13241324

13251325
if (ftp->use_ssl && ftp->fd == s && ftp->ssl_active) {
13261326
handle = ftp->ssl_handle;

0 commit comments

Comments
 (0)