From: Sara Golemon Date: Fri, 20 Feb 2004 21:05:37 +0000 (+0000) Subject: s_addr is always unsigned 32bit, long is not. X-Git-Tag: RELEASE_0_2_0~243 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4113da3f86fe48390b263d8b522191c61e5ede87;p=php s_addr is always unsigned 32bit, long is not. --- diff --git a/ext/ftp/ftp.c b/ext/ftp/ftp.c index e5d7ccffab..8ec5a540a8 100644 --- a/ext/ftp/ftp.c +++ b/ext/ftp/ftp.c @@ -775,7 +775,8 @@ ftp_pasv(ftpbuf_t *ftp, int pasv) } sin = (struct sockaddr_in *) sa; sin->sin_family = AF_INET; - sin->sin_addr.s_addr = ipbox.l[0]; + /* Deal with differing integer sizes */ + memcpy(&(sin->sin_addr.s_addr), &(ipbox.c[0]), 4); sin->sin_port = ipbox.s[2]; ftp->pasv = 2; @@ -1480,7 +1481,7 @@ ftp_getdata(ftpbuf_t *ftp TSRMLS_DC) #endif /* send the PORT */ - ipbox.l[0] = ((struct sockaddr_in*) sa)->sin_addr.s_addr; + memcpy(&(ipbox.c[0]), &(((struct sockaddr_in*) sa)->sin_addr.s_addr), 4); 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]);