summaryrefslogtreecommitdiff
path: root/authfile.c
diff options
context:
space:
mode:
Diffstat (limited to 'authfile.c')
-rw-r--r--authfile.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/authfile.c b/authfile.c
index 734d657e9..96d2bf338 100644
--- a/authfile.c
+++ b/authfile.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: authfile.c,v 1.90 2011/05/13 00:05:36 djm Exp $ */ 1/* $OpenBSD: authfile.c,v 1.91 2011/05/23 07:24:57 djm Exp $ */
2/* 2/*
3 * Author: Tatu Ylonen <ylo@cs.hut.fi> 3 * Author: Tatu Ylonen <ylo@cs.hut.fi>
4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -774,8 +774,11 @@ key_try_load_public(Key *k, const char *filename, char **commentp)
774 ; 774 ;
775 if (*cp) { 775 if (*cp) {
776 if (key_read(k, &cp) == 1) { 776 if (key_read(k, &cp) == 1) {
777 if (commentp) 777 cp[strcspn(cp, "\r\n")] = '\0';
778 *commentp=xstrdup(filename); 778 if (commentp) {
779 *commentp = xstrdup(*cp ?
780 cp : filename);
781 }
779 fclose(f); 782 fclose(f);
780 return 1; 783 return 1;
781 } 784 }