diff --git a/libssh/channels1.c b/libssh/channels1.c index 611c99b7..914cd386 100644 --- a/libssh/channels1.c +++ b/libssh/channels1.c @@ -282,7 +282,7 @@ int channel_write1(ssh_channel channel, const void *data, int len) { SSH_SESSION *session = channel->session; int origlen = len; int effectivelen; - + const unsigned char *ptr=data; while (len > 0) { if (buffer_add_u8(session->out_buffer, SSH_CMSG_STDIN_DATA) < 0) { return -1; @@ -291,11 +291,11 @@ int channel_write1(ssh_channel channel, const void *data, int len) { effectivelen = len > 32000 ? 32000 : len; if (buffer_add_u32(session->out_buffer, htonl(effectivelen)) < 0 || - buffer_add_data(session->out_buffer, data, effectivelen) < 0) { + buffer_add_data(session->out_buffer, ptr, effectivelen) < 0) { return -1; } - data += effectivelen; + ptr += effectivelen; len -= effectivelen; if (packet_send(session) != SSH_OK) { diff --git a/libssh/packet.c b/libssh/packet.c index 4aadf56e..f0a56b17 100644 --- a/libssh/packet.c +++ b/libssh/packet.c @@ -318,7 +318,7 @@ static int packet_read1(SSH_SESSION *session) { } memcpy(&crc, - buffer_get_rest(session->in_buffer) + (len+padding) - sizeof(uint32_t), + (unsigned char *)buffer_get_rest(session->in_buffer) + (len+padding) - sizeof(uint32_t), sizeof(uint32_t)); buffer_pass_bytes_end(session->in_buffer, sizeof(uint32_t)); crc = ntohl(crc); @@ -544,7 +544,7 @@ static int packet_send1(SSH_SESSION *session) { goto error; } - crc = ssh_crc32(buffer_get(session->out_buffer) + sizeof(uint32_t), + crc = ssh_crc32((char *)buffer_get(session->out_buffer) + sizeof(uint32_t), buffer_get_len(session->out_buffer) - sizeof(uint32_t)); if (buffer_add_u32(session->out_buffer, ntohl(crc)) < 0) { @@ -556,7 +556,7 @@ static int packet_send1(SSH_SESSION *session) { buffer_get_len(session->out_buffer)); #endif - packet_encrypt(session, buffer_get(session->out_buffer) + sizeof(uint32_t), + packet_encrypt(session, (unsigned char *)buffer_get(session->out_buffer) + sizeof(uint32_t), buffer_get_len(session->out_buffer) - sizeof(uint32_t)); #ifdef DEBUG_CRYPTO