diff options
author | ume <ume@FreeBSD.org> | 2000-07-10 10:00:20 +0000 |
---|---|---|
committer | ume <ume@FreeBSD.org> | 2000-07-10 10:00:20 +0000 |
commit | 9a76d32b2b29b832ac35d0b0f3cae4819fe9ca15 (patch) | |
tree | 8e80b2f77eb4054bacb18b3c84bab3a246b27896 /lib/libftpio | |
parent | 53039364ea8060ac02fc2ce94462379a2b6f729a (diff) | |
download | FreeBSD-src-9a76d32b2b29b832ac35d0b0f3cae4819fe9ca15.zip FreeBSD-src-9a76d32b2b29b832ac35d0b0f3cae4819fe9ca15.tar.gz |
Separate parsing code of 229 replies from the code for 227 and 228.
Don't assume 227 and 228 replies enclose remote address with parentheses.
Diffstat (limited to 'lib/libftpio')
-rw-r--r-- | lib/libftpio/ftpio.c | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/lib/libftpio/ftpio.c b/lib/libftpio/ftpio.c index 0c5c0ef..d4e4a9e 100644 --- a/lib/libftpio/ftpio.c +++ b/lib/libftpio/ftpio.c @@ -867,13 +867,14 @@ ftp_file_op(FTP_t ftp, char *operation, char *file, FILE **fp, char *mode, off_t } else cmdstr = "EPSV"; } - while (*q && *q != '(') /* ) */ - q++; - if (!*q) { - ftp_close(ftp); - return FAILURE; - } if (strcmp(cmdstr, "PASV") == 0 || strcmp(cmdstr, "LPSV") == 0) { + while (*q && !isdigit(*q)) + q++; + if (!*q) { + ftp_close(ftp); + return FAILURE; + } + q--; l = (ftp->addrtype == AF_INET ? 6 : 21); for (i = 0; i < l; i++) { q++; @@ -893,6 +894,12 @@ ftp_file_op(FTP_t ftp, char *operation, char *file, FILE **fp, char *mode, off_t } else if (strcmp(cmdstr, "EPSV") == 0) { int port; int sinlen; + while (*q && *q != '(') /* ) */ + q++; + if (!*q) { + ftp_close(ftp); + return FAILURE; + } q++; if (sscanf(q, "%c%c%c%d%c", &addr[0], &addr[1], &addr[2], &port, &addr[3]) != 5 |