On Thu, 11 Dec 2014, Marc Renault wrote:

Thanks for your research!

Based on the previous posts, I did some digging to see what is going on
with the libssh2_sftp_stat_ex call at ssh.c:2089. From what I can tell, the
call works fine. But the flags that are set are only:
SSH_FILEXFER_ATTR_PERMISSIONS 0x00000004
SSH_FILEXFER_ATTR_ACCESSTIME  0x00000008
That is the value of attrs.flags is 12.

Essentially, the code handles the case where there server doesn't respond to the SSH_FXP_STAT but doesn't consider the case that a server might respond to SSH_FXP_STAT without a file size. My proposed fix is the following:

Hm, it isn't a totally bad work-around as it seems an SFTP client shouldn't make assumptions of what data that is returned. Have you tried downloading a zero byte file with this work-around applied?

--

 / daniel.haxx.se
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html

Reply via email to