1
0
mirror of https://github.com/libssh2/libssh2.git synced 2025-07-02 22:02:25 +03:00

sftp_readdir: return error if buffer is too small

If asked to read data into a buffer and the buffer is too small to hold
the data, this function now returns an error instead of as previously
just copy as much as fits.
This commit is contained in:
Daniel Stenberg
2011-01-04 14:30:04 +01:00
parent f9b1b95059
commit 164838c7dd
2 changed files with 20 additions and 10 deletions

View File

@ -45,9 +45,9 @@ zero), or negative on failure. It returns LIBSSH2_ERROR_EAGAIN when it would
otherwise block. While LIBSSH2_ERROR_EAGAIN is a negative number, it isn't
really a failure per se.
.SH BUG
Passing in a too small buffer when receiving data only results in libssh2 not
copying the entire data amount, and it is not possible for the application to
tell when it happens!
Passing in a too small buffer for 'buffer' or 'longentry' when receiving data
only results in libssh2 1.2.7 or earlier to not copy the entire data amount,
and it is not possible for the application to tell when it happens!
.SH ERRORS
\fILIBSSH2_ERROR_ALLOC\fP - An internal memory allocation call failed.
@ -58,6 +58,10 @@ tell when it happens!
\fILIBSSH2_ERROR_SFTP_PROTOCOL\fP - An invalid SFTP protocol response was
received on the socket, or an SFTP operation caused an errorcode to be
returned by the server.
From 1.2.8, LIBSSH2_ERROR_BUFFER_TOO_SMALL is returned if any of the
given 'buffer' or 'longentry' buffers are too small to fit the requested
object name.
.SH SEE ALSO
.BR libssh2_sftp_open_ex(3),
.BR libssh2_sftp_close_handle(3)