Browse Source

s_addr is always unsigned 32bit, long is not.

PEAR_1_4DEV
Sara Golemon 23 years ago
parent
commit
4113da3f86
  1. 5
      ext/ftp/ftp.c

5
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]);

Loading…
Cancel
Save