summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/pki.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/pki.c b/src/pki.c
index 9f677b0..977f4bc 100644
--- a/src/pki.c
+++ b/src/pki.c
@@ -457,6 +457,7 @@ int ssh_pki_import_privkey_file(const char *filename,
filename, strerror(errno));
return SSH_ERROR;
}
+ key_buf[size] = 0;
key = pki_private_key_from_base64(key_buf, passphrase, auth_fn, auth_data);
SAFE_FREE(key_buf);
@@ -815,6 +816,10 @@ int ssh_pki_import_pubkey_file(const char *filename, ssh_key *pkey)
return SSH_ERROR;
}
+ if (sb.st_size + 1 < sb.st_size) {
+ return SSH_ERROR;
+ }
+
file = fopen(filename, "r");
if (file == NULL) {
ssh_pki_log("Error opening %s: %s",