Ticket #1460: ControlSocket.cpp.2.patch
File ControlSocket.cpp.2.patch, 1.5 KB (added by , 20 years ago) |
---|
-
C:/Documents
643 643 i=args.ReverseFind('.'); 644 644 port+=256*atoi(args.Right(args.GetLength()-(i+1))); // add ms byte to server socket 645 645 ip=args.Left(i); 646 647 if(inet_addr(ip) == INADDR_NONE) 648 { 649 // Fix: Convert IP in PORT command to int and back to string (strips 650 // leading zeros) because some FTP clients prepend zeros to it. 651 // inet_addr() thinks this is an octal number and will return INADDR_NONE 652 // if 8 or 9 are encountered. 653 // 12/13/2004 DKW 654 CString DecIP = ""; 655 char *TempIP = ip.GetBuffer(); 656 char *tok; 657 const char *sep = "."; 658 int oct = 0; 659 char tmp[4]; 646 660 647 if (inet_addr(ip)==INADDR_NONE || port<1 || port>65535) 661 tok = strtok(TempIP,sep); 662 663 while(tok != NULL){ 664 oct = atoi(tok); 665 itoa(oct,tmp,10); 666 DecIP += tmp; 667 DecIP += "."; 668 tok = strtok(NULL, sep); 669 } 670 671 ip.ReleaseBuffer(); 672 673 ip = DecIP.Left(DecIP.GetLength() - 1); 674 } 675 676 if(inet_addr(ip) == INADDR_NONE || port < 1 || port > 65535) 648 677 { 649 678 Send("501 Syntax error"); 650 679 break;