diff options
| author | Dag-Erling Smørgrav <des@FreeBSD.org> | 2019-02-05 15:03:53 +0000 |
|---|---|---|
| committer | Dag-Erling Smørgrav <des@FreeBSD.org> | 2019-02-05 15:03:53 +0000 |
| commit | d18f6dc96dad76cff84fd737d2078bbdcc5cf738 (patch) | |
| tree | 2b6b1959725f0340656e8e30bde9107019ffb422 /authfile.c | |
| parent | 85f19ec0ec269b902d29184ff0b8aeb93d9ecb75 (diff) | |
Vendor import of OpenSSH 7.9p1.vendor/openssh/7.9p1
Diffstat (limited to 'authfile.c')
| -rw-r--r-- | authfile.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/authfile.c b/authfile.c index be4a57736acf..b1c92f4ad621 100644 --- a/authfile.c +++ b/authfile.c @@ -1,4 +1,4 @@ -/* $OpenBSD: authfile.c,v 1.130 2018/07/09 21:59:10 markus Exp $ */ +/* $OpenBSD: authfile.c,v 1.131 2018/09/21 12:20:12 djm Exp $ */ /* * Copyright (c) 2000, 2013 Markus Friedl. All rights reserved. * @@ -459,6 +459,8 @@ sshkey_in_file(struct sshkey *key, const char *filename, int strict_type, return SSH_ERR_SYSTEM_ERROR; while (getline(&line, &linesize, f) != -1) { + sshkey_free(pub); + pub = NULL; cp = line; /* Skip leading whitespace. */ @@ -477,16 +479,20 @@ sshkey_in_file(struct sshkey *key, const char *filename, int strict_type, r = SSH_ERR_ALLOC_FAIL; goto out; } - if ((r = sshkey_read(pub, &cp)) != 0) + switch (r = sshkey_read(pub, &cp)) { + case 0: + break; + case SSH_ERR_KEY_LENGTH: + continue; + default: goto out; + } if (sshkey_compare(key, pub) || (check_ca && sshkey_is_cert(key) && sshkey_compare(key->cert->signature_key, pub))) { r = 0; goto out; } - sshkey_free(pub); - pub = NULL; } r = SSH_ERR_KEY_NOT_FOUND; out: |
