diff options
-rw-r--r-- | include/libssh/pki.h | 2 | ||||
-rw-r--r-- | src/pki.c | 2 |
2 files changed, 3 insertions, 1 deletions
diff --git a/include/libssh/pki.h b/include/libssh/pki.h index b9da5fb..881472d 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 @@ -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; } |