Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ftp_get/ftp_nb_get resumepos offset is maximum 10GB #10521

Closed
cyber4len opened this issue Feb 6, 2023 · 1 comment
Closed

ftp_get/ftp_nb_get resumepos offset is maximum 10GB #10521

cyber4len opened this issue Feb 6, 2023 · 1 comment

Comments

@cyber4len
Copy link

Description

The following code:

<?php

$ret = ftp_nb_fget($conn_id, $fout, "test.bin", FTP_BINARY, 12345678910);

Resulted in this commands sent to FTP server:

REST 1234567891
RETR test.bin

But I expected this commands instead:

REST 12345678910
RETR test.bin

PHP Version

PHP 8.0.12

Operating System

No response

@nielsdos
Copy link
Member

nielsdos commented Feb 6, 2023

Seems like this is the issue:

char arg[11];

The buffer is too small so the string gets cut off, I'll fix it tonight.
EDIT: it looks like there's a few places, I'll fix them all up.

nielsdos added a commit to nielsdos/php-src that referenced this issue Feb 6, 2023
The char arrays were too small for a long on 64-bit systems, which
resulted in cutting off the string at the end with a NUL byte. Use a
size of MAX_LENGTH_OF_LONG to fix this issue instead of a fixed size
of 11 chars.
nielsdos added a commit to nielsdos/php-src that referenced this issue Feb 7, 2023
The char arrays were too small for a long on 64-bit systems, which
resulted in cutting off the string at the end with a NUL byte. Use a
size of MAX_LENGTH_OF_LONG to fix this issue instead of a fixed size
of 11 chars.
nielsdos added a commit that referenced this issue Mar 20, 2023
* PHP-8.1:
  Fix GH-10521: ftp_get/ftp_nb_get resumepos offset is maximum 10GB
nielsdos added a commit that referenced this issue Mar 20, 2023
* PHP-8.2:
  Fix GH-10521: ftp_get/ftp_nb_get resumepos offset is maximum 10GB
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants
@nielsdos @cyber4len and others