summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenis Vlasenko2006-11-21 11:04:31 +0000
committerDenis Vlasenko2006-11-21 11:04:31 +0000
commit40f62a8c3de7f9438c2137d181dde525b40a88c3 (patch)
tree30f577eb1bb57bbbc5d61c1d3533a1ca1f598eec
parent3e7ef7ead43b4b43efc92c2923fa8ed68bc9f2bd (diff)
downloadbusybox-40f62a8c3de7f9438c2137d181dde525b40a88c3.zip
busybox-40f62a8c3de7f9438c2137d181dde525b40a88c3.tar.gz
wget: fix ftp PASV mode ("numeric" check was too strict)
-rw-r--r--networking/wget.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/networking/wget.c b/networking/wget.c
index 69cabfc..abc011c 100644
--- a/networking/wget.c
+++ b/networking/wget.c
@@ -414,9 +414,11 @@ int wget_main(int argc, char **argv)
pasv_error:
bb_error_msg_and_die("bad response to %s: %s", "PASV", buf);
}
- // Response is "227 garbageN1,N2,N3,N4,P1,P2
+ // Response is "227 garbageN1,N2,N3,N4,P1,P2[)]
// Server's IP is N1.N2.N3.N4 (we ignore it)
// Server's port for data connection is P1*256+P2
+ s = strrchr(buf, ')');
+ if (s && !s[1]) s[0] = '\0';
s = strrchr(buf, ',');
if (!s) goto pasv_error;
port = xatol_range(s+1, 0, 255);
@@ -608,13 +610,13 @@ static char *gethdr(char *buf, size_t bufsiz, FILE *fp, int *istrunc)
return NULL;
/* see if we are at the end of the headers */
- for (s = buf ; *s == '\r' ; ++s)
+ for (s = buf; *s == '\r'; ++s)
;
if (s[0] == '\n')
return NULL;
/* convert the header name to lower case */
- for (s = buf ; isalnum(*s) || *s == '-' ; ++s)
+ for (s = buf; isalnum(*s) || *s == '-'; ++s)
*s = tolower(*s);
/* verify we are at the end of the header name */
@@ -622,7 +624,7 @@ static char *gethdr(char *buf, size_t bufsiz, FILE *fp, int *istrunc)
bb_error_msg_and_die("bad header line: %s", buf);
/* locate the start of the header value */
- for (*s++ = '\0' ; *s == ' ' || *s == '\t' ; ++s)
+ for (*s++ = '\0'; *s == ' ' || *s == '\t'; ++s)
;
hdrval = s;