[BusyBox 0001125]: "ftpget" and "ftpput" can't access FTP server, and can't fetch ftp files with PASV mode (with patch)

bugs at busybox.net bugs at busybox.net
Fri Dec 22 03:58:29 UTC 2006


The following issue has been SUBMITTED. 
====================================================================== 
http://busybox.net/bugs/view.php?id=1125 
====================================================================== 
Reported By:                rockeychu
Assigned To:                BusyBox
====================================================================== 
Project:                    BusyBox
Issue ID:                   1125
Category:                   Networking Support
Reproducibility:            always
Severity:                   crash
Priority:                   normal
Status:                     assigned
====================================================================== 
Date Submitted:             12-21-2006 19:58 PST
Last Modified:              12-21-2006 19:58 PST
====================================================================== 
Summary:                    "ftpget" and "ftpput" can't access FTP server, and
can't fetch ftp files with PASV mode (with patch)
Description: 
"ftpget" & "ftpput" can't access FTP server, and can't fetch ftp files with
PASV mode. This happened since Revision 16684, the same problem as previous
"wget" when introduced saner bb_strtoXX.

patch as following:

Index: networking/ftpgetput.c
===================================================================
--- networking/ftpgetput.c      (revision 17039)
+++ networking/ftpgetput.c      (working copy)
@@ -49,6 +49,8 @@
                        *buf_ptr = '\0';
                }
        } while (!isdigit(buf[0]) || buf[3] != ' ');
+
+       buf[3] = '\0';

        return xatou(buf);
 }
@@ -58,6 +60,9 @@
        char *buf_ptr;
        unsigned short port_num;

+       buf_ptr = strrchr(buf, ')');
+       if (buf_ptr) *buf_ptr = '\0';
+
        buf_ptr = strrchr(buf, ',');
        *buf_ptr = '\0';
        port_num = xatoul_range(buf_ptr + 1, 0, 255);
@@ -123,7 +128,7 @@
        if (ftpcmd("PASV", NULL, control_stream, buf) != 227) {
                bb_error_msg_and_die("PASV error: %s", buf + 4);
        }
-       fd_data = xconnect_ftpdata(server, buf);
+       fd_data = xconnect_ftpdata(server, buf + 4);

        if (ftpcmd("SIZE ", server_path, control_stream, buf) == 213) {
                //filesize = BB_STRTOOFF(buf + 4, NULL, 10);
@@ -211,7 +216,7 @@
        if (ftpcmd("PASV", NULL, control_stream, buf) != 227) {
                bb_error_msg_and_die("PASV error: %s", buf + 4);
        }
-       fd_data = xconnect_ftpdata(server, buf);
+       fd_data = xconnect_ftpdata(server, buf + 4);

        /* get the local file */
        fd_local = STDIN_FILENO;

====================================================================== 

Issue History 
Date Modified   Username       Field                    Change               
====================================================================== 
12-21-06 19:58  rockeychu      New Issue                                    
12-21-06 19:58  rockeychu      Status                   new => assigned     
12-21-06 19:58  rockeychu      Assigned To               => BusyBox         
======================================================================




More information about the busybox-cvs mailing list