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

channels: Fix integer and bool argument of channel_default_bufferize()

Fixes T188

Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
Reviewed-by: Jakub Jelen <jjelen@redhat.com>
This commit is contained in:
Andreas Schneider
2019-10-31 13:44:02 +01:00
parent 6f39deefcd
commit dad2720355
3 changed files with 12 additions and 6 deletions

View File

@@ -97,8 +97,9 @@ SSH_PACKET_CALLBACK(channel_rcv_close);
SSH_PACKET_CALLBACK(channel_rcv_request); SSH_PACKET_CALLBACK(channel_rcv_request);
SSH_PACKET_CALLBACK(channel_rcv_data); SSH_PACKET_CALLBACK(channel_rcv_data);
int channel_default_bufferize(ssh_channel channel, void *data, int len, int channel_default_bufferize(ssh_channel channel,
int is_stderr); void *data, size_t len,
bool is_stderr);
int ssh_channel_flush(ssh_channel channel); int ssh_channel_flush(ssh_channel channel);
uint32_t ssh_channel_new_id(ssh_session session); uint32_t ssh_channel_new_id(ssh_session session);
ssh_channel ssh_channel_from_local(ssh_session session, uint32_t id); ssh_channel ssh_channel_from_local(ssh_session session, uint32_t id);

View File

@@ -844,8 +844,10 @@ SSH_PACKET_CALLBACK(channel_rcv_request) {
* *
* FIXME is the window changed? * FIXME is the window changed?
*/ */
int channel_default_bufferize(ssh_channel channel, void *data, int len, int channel_default_bufferize(ssh_channel channel,
int is_stderr) { void *data, size_t len,
bool is_stderr)
{
ssh_session session; ssh_session session;
if(channel == NULL) { if(channel == NULL) {
@@ -860,8 +862,10 @@ int channel_default_bufferize(ssh_channel channel, void *data, int len,
} }
SSH_LOG(SSH_LOG_PACKET, SSH_LOG(SSH_LOG_PACKET,
"placing %d bytes into channel buffer (stderr=%d)", len, is_stderr); "placing %zu bytes into channel buffer (%s)",
if (is_stderr == 0) { len,
is_stderr ? "stderr" : "stdout");
if (!is_stderr) {
/* stdout */ /* stdout */
if (channel->stdout_buffer == NULL) { if (channel->stdout_buffer == NULL) {
channel->stdout_buffer = ssh_buffer_new(); channel->stdout_buffer = ssh_buffer_new();

View File

@@ -25,6 +25,7 @@
#include <errno.h> #include <errno.h>
#include <fcntl.h> #include <fcntl.h>
#include <stdbool.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>