diff options
author | Damien Miller <djm@cvs.openbsd.org> | 2004-08-23 11:48:10 +0000 |
---|---|---|
committer | Damien Miller <djm@cvs.openbsd.org> | 2004-08-23 11:48:10 +0000 |
commit | ef6274034d233fc31845aa17f02eef96560b0d0a (patch) | |
tree | 59cef0342f56fa8fe0252c92be1ca1abdcd96b6d /usr.bin/ssh/authfile.c | |
parent | 3d9c2d283e8b2dd81afb18ff3e961f98b29bbca8 (diff) |
fix error path, spotted by Martin.Kraemer AT Fujitsu-Siemens.com; ok markus
Diffstat (limited to 'usr.bin/ssh/authfile.c')
-rw-r--r-- | usr.bin/ssh/authfile.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/usr.bin/ssh/authfile.c b/usr.bin/ssh/authfile.c index 8e80dd9e76c..a528577d084 100644 --- a/usr.bin/ssh/authfile.c +++ b/usr.bin/ssh/authfile.c @@ -36,7 +36,7 @@ */ #include "includes.h" -RCSID("$OpenBSD: authfile.c,v 1.57 2004/06/21 17:36:31 avsm Exp $"); +RCSID("$OpenBSD: authfile.c,v 1.58 2004/08/23 11:48:09 djm Exp $"); #include <openssl/err.h> #include <openssl/evp.h> @@ -243,8 +243,10 @@ key_load_public_rsa1(int fd, const char *filename, char **commentp) filename, strerror(errno)); return NULL; } - if (st.st_size > 1*1024*1024) - close(fd); + if (st.st_size > 1*1024*1024) { + error("key file %.200s too large", filename); + return NULL; + } len = (size_t)st.st_size; /* truncated */ buffer_init(&buffer); @@ -335,6 +337,7 @@ key_load_private_rsa1(int fd, const char *filename, const char *passphrase, return NULL; } if (st.st_size > 1*1024*1024) { + error("key file %.200s too large", filename); close(fd); return (NULL); } |