summaryrefslogtreecommitdiffstats
path: root/usr.bin/ssh/readconf.c
diff options
context:
space:
mode:
authormarkus <markus@openbsd.org>2018-06-06 18:29:18 +0000
committermarkus <markus@openbsd.org>2018-06-06 18:29:18 +0000
commite3941638b86e489e7a433e702729d0c6930ef56c (patch)
treec8d6a67362f25e84c59520a843ad616f7ddc0c1a /usr.bin/ssh/readconf.c
parentregress test for PermitOpen (diff)
downloadwireguard-openbsd-e3941638b86e489e7a433e702729d0c6930ef56c.tar.xz
wireguard-openbsd-e3941638b86e489e7a433e702729d0c6930ef56c.zip
switch config file parsing to getline(3) as this avoids static limits
noted by gerhard@; ok dtucker@, djm@
Diffstat (limited to 'usr.bin/ssh/readconf.c')
-rw-r--r--usr.bin/ssh/readconf.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/usr.bin/ssh/readconf.c b/usr.bin/ssh/readconf.c
index e580a910de9..256e81d6d60 100644
--- a/usr.bin/ssh/readconf.c
+++ b/usr.bin/ssh/readconf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: readconf.c,v 1.288 2018/06/01 03:33:53 djm Exp $ */
+/* $OpenBSD: readconf.c,v 1.289 2018/06/06 18:29:18 markus Exp $ */
/*
* Author: Tatu Ylonen <ylo@cs.hut.fi>
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -1713,7 +1713,8 @@ read_config_file_depth(const char *filename, struct passwd *pw,
int flags, int *activep, int depth)
{
FILE *f;
- char line[4096];
+ char *line = NULL;
+ size_t linesize = 0;
int linenum;
int bad_options = 0;
@@ -1740,15 +1741,14 @@ read_config_file_depth(const char *filename, struct passwd *pw,
* on/off by Host specifications.
*/
linenum = 0;
- while (fgets(line, sizeof(line), f)) {
+ while (getline(&line, &linesize, f) != -1) {
/* Update line number counter. */
linenum++;
- if (strlen(line) == sizeof(line) - 1)
- fatal("%s line %d too long", filename, linenum);
if (process_config_line_depth(options, pw, host, original_host,
line, filename, linenum, activep, flags, depth) != 0)
bad_options++;
}
+ free(line);
fclose(f);
if (bad_options > 0)
fatal("%s: terminating, %d bad configuration options",