]> granicus.if.org Git - php/commitdiff
s_addr is always unsigned 32bit, long is not.
authorSara Golemon <pollita@php.net>
Fri, 20 Feb 2004 21:05:37 +0000 (21:05 +0000)
committerSara Golemon <pollita@php.net>
Fri, 20 Feb 2004 21:05:37 +0000 (21:05 +0000)
ext/ftp/ftp.c

index e5d7ccffab9ee5999072706f18cac27d8da063f5..8ec5a540a8804a3fa19ed7249f225c9e20e35755 100644 (file)
@@ -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]);