summaryrefslogtreecommitdiffstats
path: root/ssh-keyscan.c
diff options
context:
space:
mode:
authormarkus@openbsd.org <markus@openbsd.org>2018-06-06 20:29:18 +0200
committerDamien Miller <djm@mindrot.org>2018-06-06 20:34:05 +0200
commit7f90635216851f6cb4bf3999e98b825f85d604f8 (patch)
treeac302db18a71c1e3c5d9077d1a820e37fbc2b9b5 /ssh-keyscan.c
parentupstream: regress test for PermitOpen (diff)
downloadopenssh-7f90635216851f6cb4bf3999e98b825f85d604f8.tar.xz
openssh-7f90635216851f6cb4bf3999e98b825f85d604f8.zip
upstream: switch config file parsing to getline(3) as this avoids
static limits noted by gerhard@; ok dtucker@, djm@ OpenBSD-Commit-ID: 6d702eabef0fa12e5a1d75c334a8c8b325298b5c
Diffstat (limited to 'ssh-keyscan.c')
-rw-r--r--ssh-keyscan.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/ssh-keyscan.c b/ssh-keyscan.c
index 381fb0844..38b1c548b 100644
--- a/ssh-keyscan.c
+++ b/ssh-keyscan.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ssh-keyscan.c,v 1.119 2018/03/02 21:40:15 jmc Exp $ */
+/* $OpenBSD: ssh-keyscan.c,v 1.120 2018/06/06 18:29:18 markus Exp $ */
/*
* Copyright 1995, 1996 by David Mazieres <dm@lcs.mit.edu>.
*
@@ -646,9 +646,9 @@ main(int argc, char **argv)
{
int debug_flag = 0, log_level = SYSLOG_LEVEL_INFO;
int opt, fopt_count = 0, j;
- char *tname, *cp, line[NI_MAXHOST];
+ char *tname, *cp, *line = NULL;
+ size_t linesize = 0;
FILE *fp;
- u_long linenum;
extern int optind;
extern char *optarg;
@@ -769,11 +769,8 @@ main(int argc, char **argv)
else if ((fp = fopen(argv[j], "r")) == NULL)
fatal("%s: %s: %s", __progname, argv[j],
strerror(errno));
- linenum = 0;
- while (read_keyfile_line(fp,
- argv[j] == NULL ? "(stdin)" : argv[j], line, sizeof(line),
- &linenum) != -1) {
+ while (getline(&line, &linesize, fp) != -1) {
/* Chomp off trailing whitespace and comments */
if ((cp = strchr(line, '#')) == NULL)
cp = line + strlen(line) - 1;
@@ -798,6 +795,7 @@ main(int argc, char **argv)
fclose(fp);
}
+ free(line);
while (optind < argc)
do_host(argv[optind++]);