Subject: libssh2_sftp_tell64() doesn't return the right pointer

libssh2_sftp_tell64() doesn't return the right pointer

From: m odd <xieepp_at_gmail.com>
Date: Wed, 24 Aug 2011 10:52:35 +0800

hello everyone!

I think there is a bug about libssh2_sftp_tell64() ,it's return value is
always smaller than the right place.

I think sftp_read() has forget to adjust the offset:

    if(filep->data_left) {
        /* data left from previous call */
        size_t copy = MIN(buffer_size, filep->data_left);

        memcpy(buffer, &filep->data[ filep->data_len - filep->data_left],
               copy);

        total_read += copy;
        filep->data_left -= copy;

        /* adjust the offset */
        filep->offset += copy;

        if(filep->data_left)
            return total_read;

        LIBSSH2_FREE(session, filep->data);
        filep->data = NULL;
    }

    /* return when data_left == buffer_size */
    if (total_read == buffer_size)
        return total_read;

_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel
Received on 2011-08-24