]> granicus.if.org Git - php/commitdiff
Fix #55857: ftp_size on large files
authorChristoph M. Becker <cmbecker69@gmx.de>
Tue, 23 Jun 2020 13:17:31 +0000 (15:17 +0200)
committerChristoph M. Becker <cmbecker69@gmx.de>
Tue, 23 Jun 2020 13:57:24 +0000 (15:57 +0200)
`atol()` returns a `long` which is not the same as `zend_long` on
LLP64; we use `ZEND_ATOL()` instead.

There is no need for a new test case, since filesize_large.phpt already
tests for that behavior; unfortunately, the FTP test suite relies on
`pcntl_fork()` and therefore cannot be run on Windows.

NEWS
ext/ftp/ftp.c

diff --git a/NEWS b/NEWS
index c0c3bdee9fb25c54f9cf8c43b71613ad96482df1..5ae4e5a1656b2cde3adcc7ac4beeb201d9e7490d 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -2,6 +2,9 @@ PHP                                                                        NEWS
 |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
 ?? ??? ????, PHP 7.3.21
 
+- FTP:
+  . Fixed bug #55857 (ftp_size on large files). (cmb)
+
 ?? ??? ????, PHP 7.3.20
 
 - Core:
index 27def54672864b6a96cac03d72d618cae034b695..0f6b711bd32e26cce9fb2db45da4cfa6d018443c 100644 (file)
@@ -1133,6 +1133,8 @@ bail:
 zend_long
 ftp_size(ftpbuf_t *ftp, const char *path, const size_t path_len)
 {
+       zend_long res;
+
        if (ftp == NULL) {
                return -1;
        }
@@ -1145,7 +1147,8 @@ ftp_size(ftpbuf_t *ftp, const char *path, const size_t path_len)
        if (!ftp_getresp(ftp) || ftp->resp != 213) {
                return -1;
        }
-       return atol(ftp->inbuf);
+       ZEND_ATOL(res, ftp->inbuf);
+       return res;
 }
 /* }}} */