aboutsummaryrefslogtreecommitdiff
path: root/src/pki.c
diff options
context:
space:
mode:
authorAndreas Schneider <asn@cryptomilk.org>2013-06-17 12:07:32 +0200
committerAndreas Schneider <asn@cryptomilk.org>2013-06-17 12:07:32 +0200
commitd83b3d9ebef272f11eab90dfccc8a87f777d8d5c (patch)
tree2bd25820b9c86ec8c16dd68ca745d5b427d501b1 /src/pki.c
parent6f8b5ed679876427c4b2ff17b60a7fa3cbd02a54 (diff)
downloadlibssh-d83b3d9ebef272f11eab90dfccc8a87f777d8d5c.tar.gz
libssh-d83b3d9ebef272f11eab90dfccc8a87f777d8d5c.tar.xz
libssh-d83b3d9ebef272f11eab90dfccc8a87f777d8d5c.zip
pki: Limit privkey to 4M for now.
Diffstat (limited to 'src/pki.c')
-rw-r--r--src/pki.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/pki.c b/src/pki.c
index e08ed4d4..a3616c2f 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);