Hello,
I'm running libssh2 with sftp file transfer under Suse Linux 11.2, 64 Bit.
Using function libssh2_sftp_readdir_ex() on a directory containing a 2GB=2^31 byte (exatcly) file reports file size = 18446744071562067968.
I've changed method
libssh2_uint64_t
_libssh2_ntohu64(const unsigned char *buf)
in src/misc.c to the following code:
libssh2_uint64_t
_libssh2_ntohu64(const unsigned char *buf)
{
unsigned long msl = 0;
unsigned long lsl = 0;
msl = ((unsigned )buf[0] << 24) | ((unsigned )buf[1] << 16) | ((unsigned )buf[2] << 8) | (unsigned )buf[3];
lsl = ((unsigned )buf[4] << 24) | ((unsigned )buf[5] << 16) | ((unsigned )buf[6] << 8) | (unsigned )buf[7];
return ((libssh2_uint64_t)msl <<32) | lsl;
}
This is essentially the same code as your original code. Only difference is the explicit cast of buf[i] to unsigned int.
I did not observe this problem running in a 32 bit environment. My gcc version 4.4.1 uses 8 bytes for long and 4 bytes for int in the 64 bit environment. In 32 bit environment both have size 4 bytes.
Best regards
Arno
-- Neu: GMX De-Mail - Einfach wie E-Mail, sicher wie ein Brief! Jetzt De-Mail-Adresse reservieren: http://portal.gmx.net/de/go/demail _______________________________________________ libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-develReceived on 2011-01-10