aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libssh/auth.c4
-rw-r--r--libssh/keyfiles.c7
-rw-r--r--libssh/wrapper.c2
3 files changed, 9 insertions, 4 deletions
diff --git a/libssh/auth.c b/libssh/auth.c
index 57d0bd61..24d3cd72 100644
--- a/libssh/auth.c
+++ b/libssh/auth.c
@@ -587,7 +587,7 @@ static int kbdauth_info_get(SSH_SESSION *session){
STRING *instruction;
STRING *tmp;
u32 nprompts;
- int i;
+ u32 i;
enter_function();
name=buffer_get_ssh_string(session->in_buffer);
instruction=buffer_get_ssh_string(session->in_buffer);
@@ -642,7 +642,7 @@ static int kbdauth_info_get(SSH_SESSION *session){
/* sends challenge back to the server */
static int kbdauth_send(SSH_SESSION *session) {
STRING *answer;
- int i;
+ u32 i;
int err;
enter_function();
buffer_add_u8(session->out_buffer,SSH2_MSG_USERAUTH_INFO_RESPONSE);
diff --git a/libssh/keyfiles.c b/libssh/keyfiles.c
index eb876059..a0b71a40 100644
--- a/libssh/keyfiles.c
+++ b/libssh/keyfiles.c
@@ -938,6 +938,7 @@ int ssh_write_knownhost(SSH_SESSION *session){
unsigned char *pubkey_64;
STRING *pubkey=session->current_crypto->server_pubkey;
char buffer[4096];
+ size_t len = 0;
FILE *file;
ssh_options_default_known_hosts_file(session->options);
if(!session->options->host){
@@ -992,7 +993,11 @@ int ssh_write_knownhost(SSH_SESSION *session){
snprintf(buffer,sizeof(buffer),"%s %s %s\n",session->options->host,session->current_crypto->server_pubkey_type,pubkey_64);
free(pubkey_64);
}
- fwrite(buffer,strlen(buffer),1,file);
+ len = strlen(buffer);
+ if (fwrite(buffer, len, 1, file) != len || ferror(file)) {
+ fclose(file);
+ return -1;
+ }
fclose(file);
return 0;
}
diff --git a/libssh/wrapper.c b/libssh/wrapper.c
index 1c848c97..151d4976 100644
--- a/libssh/wrapper.c
+++ b/libssh/wrapper.c
@@ -399,7 +399,7 @@ static struct crypto_struct ssh_ciphertab[]={
{ "3des-cbc-ssh1",8,sizeof(DES_key_schedule)*3,NULL,192,des3_set_key,
des3_set_key,des3_1_encrypt, des3_1_decrypt},
#endif
- { NULL,0,0,NULL,0,NULL,NULL,NULL}
+ { NULL,0,0,NULL,0,NULL,NULL,NULL,NULL}
};
#endif /* OPENSSL_CRYPTO */