1
0
mirror of https://git.libssh.org/projects/libssh.git synced 2025-09-11 13:30:43 +03:00

packet: Fix ssh_packet_socket_callback() return value

According to the documentation the return value is the number of
processed bytes, so the returned value is never negative. We should not
use ssize_t in public headers as it isn't available on Windows! We only
have it defined in priv.h!

Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
Reviewed-by: Jakub Jelen <jjelen@redhat.com>
This commit is contained in:
Andreas Schneider
2022-06-21 15:37:48 +02:00
committed by Jakub Jelen
parent 2ba4b51e0f
commit 7bcc2d83a4
5 changed files with 15 additions and 15 deletions

View File

@@ -94,7 +94,7 @@ static void socket_callback_connected(int code, int errno_code, void *user)
* @param user is a pointer to session
* @returns Number of bytes processed, or zero if the banner is not complete.
*/
static ssize_t callback_receive_banner(const void *data, size_t len, void *user)
static size_t callback_receive_banner(const void *data, size_t len, void *user)
{
char *buffer = (char *)data;
ssh_session session = (ssh_session) user;
@@ -107,7 +107,7 @@ static ssize_t callback_receive_banner(const void *data, size_t len, void *user)
"Wrong state in callback_receive_banner : %d",
session->session_state);
return SSH_ERROR;
return 0;
}
for (i = 0; i < len; ++i) {
#ifdef WITH_PCAP