aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/libssh/pki.h2
-rw-r--r--src/pki.c2
2 files changed, 3 insertions, 1 deletions
diff --git a/include/libssh/pki.h b/include/libssh/pki.h
index b9da5fb6..881472dc 100644
--- a/include/libssh/pki.h
+++ b/include/libssh/pki.h
@@ -31,6 +31,8 @@
#include "libssh/crypto.h"
+#define MAX_PUBKEY_SIZE 0x100000 /* 1M */
+
#define SSH_KEY_FLAG_EMPTY 0x0
#define SSH_KEY_FLAG_PUBLIC 0x0001
#define SSH_KEY_FLAG_PRIVATE 0x0002
diff --git a/src/pki.c b/src/pki.c
index 977f4bc1..87d7e765 100644
--- a/src/pki.c
+++ b/src/pki.c
@@ -816,7 +816,7 @@ int ssh_pki_import_pubkey_file(const char *filename, ssh_key *pkey)
return SSH_ERROR;
}
- if (sb.st_size + 1 < sb.st_size) {
+ if (sb.st_size > MAX_PUBKEY_SIZE) {
return SSH_ERROR;
}