summaryrefslogtreecommitdiffstats
path: root/crypto/openssh/authfile.c
diff options
context:
space:
mode:
authordes <des@FreeBSD.org>2005-06-05 15:46:09 +0000
committerdes <des@FreeBSD.org>2005-06-05 15:46:09 +0000
commit983ad11a1c78949e86a0f51f51ef0d614cc5e665 (patch)
tree7d41ca8690f59b7463bd4d5fefde78dac8a00e60 /crypto/openssh/authfile.c
parent3c5bc6b274083ffa3a7aa67e87c8936a1778eff5 (diff)
downloadFreeBSD-src-983ad11a1c78949e86a0f51f51ef0d614cc5e665.zip
FreeBSD-src-983ad11a1c78949e86a0f51f51ef0d614cc5e665.tar.gz
Resolve conflicts.
Diffstat (limited to 'crypto/openssh/authfile.c')
-rw-r--r--crypto/openssh/authfile.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/crypto/openssh/authfile.c b/crypto/openssh/authfile.c
index 76a60d0..6a04cd7 100644
--- a/crypto/openssh/authfile.c
+++ b/crypto/openssh/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.60 2004/12/11 01:48:56 dtucker Exp $");
#include <openssl/err.h>
#include <openssl/evp.h>
@@ -51,6 +51,7 @@ RCSID("$OpenBSD: authfile.c,v 1.57 2004/06/21 17:36:31 avsm Exp $");
#include "log.h"
#include "authfile.h"
#include "rsa.h"
+#include "misc.h"
/* Version identification string for SSH v1 identity files. */
static const char authfile_id_string[] =
@@ -243,8 +244,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 +338,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);
}
@@ -598,13 +602,14 @@ static int
key_try_load_public(Key *k, const char *filename, char **commentp)
{
FILE *f;
- char line[4096];
+ char line[SSH_MAX_PUBKEY_BYTES];
char *cp;
+ u_long linenum = 0;
f = fopen(filename, "r");
if (f != NULL) {
- while (fgets(line, sizeof(line), f)) {
- line[sizeof(line)-1] = '\0';
+ while (read_keyfile_line(f, filename, line, sizeof(line),
+ &linenum) != -1) {
cp = line;
switch (*cp) {
case '#':
OpenPOWER on IntegriCloud