Subject: "negative" filesize with libssh2_sftp_stat_ex!

"negative" filesize with libssh2_sftp_stat_ex!

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Sat, 16 Oct 2010 19:57:16 +0200 (CEST)

Hi friends,

Over in the curl project Ernest Beinrohr reported a problem with SFTP[1] when
downloading from certain servers. It turns out libssh2 reports a negative file
size then in the stat struct returned from libssh2_sftp_stat_ex()! The actual
file sizes have been > 2GB and < 4GB (while >4GB worked fine!).

libssh2 returns a uint64_t for file size, so it's not really negative, but due
to non-relevant circumstances, libcurl works with that as a signed 64bit
variable and _that_ turns negative at these times. It would mean that the
highest bit is set, which doesn't reflect reality.

I've personally not been able to repeat this problem so I've not yet
detirmined if libssh2 is wrong or if the error is simply passed on from the
server.

I'm very interested to hear if anyone else have seen this problem or have any
ideas on what's going on!

[1] =
http://sourceforge.net/tracker/?func=detail&aid=3076430&group_id=976&atid=100976

-- 
  / daniel.haxx.se
_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel
Received on 2010-10-16