php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #15296 ftp_getresp()'s bug when ftp server returns multiple response code
Submitted: 2002-01-30 04:59 UTC Modified: 2002-07-10 23:18 UTC
Votes:2
Avg. Score:5.0 ± 0.0
Reproduced:2 of 2 (100.0%)
Same Version:1 (50.0%)
Same OS:1 (50.0%)
From: yiwakiri at st dot rim dot or dot jp Assigned:
Status: Closed Package: FTP related
PHP Version: 4.1.1 OS: Maybe All platform
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: yiwakiri at st dot rim dot or dot jp
New email:
PHP Version: OS:

 

 [2002-01-30 04:59 UTC] yiwakiri at st dot rim dot or dot jp
Hello.

When ftp-server returns multiple response code, ftp_nlist() and ftp_rawlist() is hung.

First response code is set normaly.
but second response code isn't set and ftp_get_resp() triing call ftp_readline() until ftp-timeout.

I change ftp_getresp in ftp.c

int
ftp_getresp(ftpbuf_t *ftp)
{
    char *buf;

    if (ftp == NULL) return 0;
    buf = ftp->inbuf;
    ftp->resp = 0;

    while (1) {

        if (!ftp_readline(ftp)) {
            return 0;
        }

        /* Break out when the end-tag is found */
        if (isdigit(ftp->inbuf[0]) && 
            isdigit(ftp->inbuf[1]) && 
            isdigit(ftp->inbuf[2]) && 
            ftp->inbuf[3] == ' ') {
            break;
        }
    }

    /* translate the tag */
    if (!isdigit(ftp->inbuf[0]) ||
        !isdigit(ftp->inbuf[1]) ||
        !isdigit(ftp->inbuf[2]))
    {
        return 0;
    }

    ftp->resp =	100 * (ftp->inbuf[0] - '0') +
                 10 * (ftp->inbuf[1] - '0') +
                      (ftp->inbuf[2] - '0');

    memmove(ftp->inbuf, ftp->inbuf + 4, FTP_BUFSIZE - 4);
    if(ftp->extra)
        ftp-extra -= 4;
    return 1;
}

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-07-10 23:18 UTC] sniper@php.net
This bug has been fixed in CVS. You can grab a snapshot of the
CVS version at http://snaps.php.net/. In case this was a documentation 
problem, the fix will show up soon at http://www.php.net/manual/.
In case this was a PHP.net website problem, the change will show
up on the PHP.net site and on the mirror sites.
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Dec 27 01:01:28 2024 UTC