Skip to content

Commit e94126a

Browse files
committed
Fix #55857: ftp_size on large files
`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.
1 parent 91982ba commit e94126a

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ PHP NEWS
22
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
33
?? ??? ????, PHP 7.3.21
44

5+
- FTP:
6+
. Fixed bug #55857 (ftp_size on large files). (cmb)
7+
58
?? ??? ????, PHP 7.3.20
69

710
- Core:

ext/ftp/ftp.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1133,6 +1133,8 @@ ftp_append(ftpbuf_t *ftp, const char *path, const size_t path_len, php_stream *i
11331133
zend_long
11341134
ftp_size(ftpbuf_t *ftp, const char *path, const size_t path_len)
11351135
{
1136+
zend_long res;
1137+
11361138
if (ftp == NULL) {
11371139
return -1;
11381140
}
@@ -1145,7 +1147,8 @@ ftp_size(ftpbuf_t *ftp, const char *path, const size_t path_len)
11451147
if (!ftp_getresp(ftp) || ftp->resp != 213) {
11461148
return -1;
11471149
}
1148-
return atol(ftp->inbuf);
1150+
ZEND_ATOL(res, ftp->inbuf);
1151+
return res;
11491152
}
11501153
/* }}} */
11511154

0 commit comments

Comments
 (0)