mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-16 06:45:42 +00:00
Bug 130299 - confused by , in PASV response message
r=gagan, sr=darin, a=asa
This commit is contained in:
parent
0cb697b1e4
commit
4b99784058
@ -1701,27 +1701,35 @@ nsFtpState::R_pasv() {
|
||||
// (xxx,xxx,xxx,xxx,ppp,ppp) or
|
||||
// xxx,xxx,xxx,xxx,ppp,ppp (without parens)
|
||||
PRInt32 h0, h1, h2, h3, p0, p1;
|
||||
while (*ptr) {
|
||||
if (*ptr == '(') {
|
||||
// move just beyond the open paren
|
||||
ptr++;
|
||||
break;
|
||||
}
|
||||
if (*ptr == ',') {
|
||||
|
||||
PRUint32 fields = 0;
|
||||
// First try with parens
|
||||
while (*ptr && *ptr != '(')
|
||||
++ptr;
|
||||
if (*ptr) {
|
||||
++ptr;
|
||||
fields = PR_sscanf(ptr,
|
||||
"%ld,%ld,%ld,%ld,%ld,%ld",
|
||||
&h0, &h1, &h2, &h3, &p0, &p1);
|
||||
}
|
||||
if (!*ptr || fields < 6) {
|
||||
// OK, lets try w/o parens
|
||||
ptr = response;
|
||||
while (*ptr && *ptr != ',')
|
||||
++ptr;
|
||||
if (*ptr) {
|
||||
// backup to the start of the digits
|
||||
do {
|
||||
ptr--;
|
||||
} while ((ptr >=response) && (*ptr >= '0') && (*ptr <= '9'));
|
||||
ptr++; // get back onto the numbers
|
||||
break;
|
||||
fields = PR_sscanf(ptr,
|
||||
"%ld,%ld,%ld,%ld,%ld,%ld",
|
||||
&h0, &h1, &h2, &h3, &p0, &p1);
|
||||
}
|
||||
ptr++;
|
||||
} // end while
|
||||
|
||||
PRInt32 fields = PR_sscanf(ptr,
|
||||
"%ld,%ld,%ld,%ld,%ld,%ld",
|
||||
&h0, &h1, &h2, &h3, &p0, &p1);
|
||||
}
|
||||
|
||||
NS_ASSERTION(fields == 6, "Can't parse PASV response");
|
||||
if (fields < 6) {
|
||||
return FTP_ERROR;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user