At 23:16 20/02/2004 +0100, Ard Biesheuvel wrote:
Sara Golemon wrote:
pollita Fri Feb 20 16:05:37 2004 EDT Modified files: /php-src/ext/ftp ftp.c Log: s_addr is always unsigned 32bit, long is not.
+ /* Deal with differing integer sizes */ + memcpy(&(sin->sin_addr.s_addr), &(ipbox.c[0]), 4);
Hi Sara,
What's wrong with (int)ipbox.l[0] ? (as sizeof(int) == 4, even if sizeof(long) is not)
Yep. This memcpy() doesn't look very good. It seems to me that it could screw up depending on the endian-ness of the machine. I'd also go for the cast.
After taking a second look, I realised my suggestion is incorrect. Byte order is not an issue here, because sin->sin_addr.s_addr and the ipbox are both in network byte order. Couldn't you just replace the long member in the union by an integer ? (Just like the bug reporter suggested ?)
-- Ard
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php