summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/pki.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/pki.c b/src/pki.c
index e08ed4d..a3616c2 100644
--- a/src/pki.c
+++ b/src/pki.c
@@ -442,6 +442,12 @@ int ssh_pki_import_privkey_file(const char *filename,
return SSH_ERROR;
}
+ if (sb.st_size > MAX_PRIVKEY_SIZE) {
+ ssh_pki_log("Private key is bigger than 4M.");
+ fclose(file);
+ return SSH_ERROR;
+ }
+
key_buf = malloc(sb.st_size + 1);
if (key_buf == NULL) {
fclose(file);