pollita Sat Feb 21 14:37:39 2004 EDT Modified files: /php-src/ext/ftp ftp.c Log: Avoid use of memcpy(), reply on struct in_addr to be right sized instead http://cvs.php.net/diff.php/php-src/ext/ftp/ftp.c?r1=1.99&r2=1.100&ty=u Index: php-src/ext/ftp/ftp.c diff -u php-src/ext/ftp/ftp.c:1.99 php-src/ext/ftp/ftp.c:1.100 --- php-src/ext/ftp/ftp.c:1.99 Fri Feb 20 16:05:37 2004 +++ php-src/ext/ftp/ftp.c Sat Feb 21 14:37:37 2004 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: ftp.c,v 1.99 2004/02/20 21:05:37 pollita Exp $ */ +/* $Id: ftp.c,v 1.100 2004/02/21 19:37:37 pollita Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -117,7 +117,7 @@ /* IP and port conversion box */ union ipbox { - unsigned long l[2]; + struct in_addr ia[2]; unsigned short s[4]; unsigned char c[8]; }; @@ -775,8 +775,7 @@ } sin = (struct sockaddr_in *) sa; sin->sin_family = AF_INET; - /* Deal with differing integer sizes */ - memcpy(&(sin->sin_addr.s_addr), &(ipbox.c[0]), 4); + sin->sin_addr = ipbox.ia[0]; sin->sin_port = ipbox.s[2]; ftp->pasv = 2; @@ -1481,7 +1480,7 @@ #endif /* send the PORT */ - memcpy(&(ipbox.c[0]), &(((struct sockaddr_in*) sa)->sin_addr.s_addr), 4); + ipbox.ia[0] = ((struct sockaddr_in*) sa)->sin_addr; ipbox.s[2] = ((struct sockaddr_in*) &addr)->sin_port; sprintf(arg, "%u,%u,%u,%u,%u,%u", ipbox.c[0], ipbox.c[1], ipbox.c[2], ipbox.c[3], ipbox.c[4], ipbox.c[5]);
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php