diff options
author | 2018-06-06 18:29:18 +0000 | |
---|---|---|
committer | 2018-06-06 18:29:18 +0000 | |
commit | e3941638b86e489e7a433e702729d0c6930ef56c (patch) | |
tree | c8d6a67362f25e84c59520a843ad616f7ddc0c1a /usr.bin/ssh/readconf.c | |
parent | regress test for PermitOpen (diff) | |
download | wireguard-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.c | 10 |
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", |