summaryrefslogtreecommitdiffstats
path: root/usr.bin/ssh/readconf.c
diff options
context:
space:
mode:
authordjm <djm@openbsd.org>2017-03-10 04:27:32 +0000
committerdjm <djm@openbsd.org>2017-03-10 04:27:32 +0000
commit24f1039126c4a08aaa3b38e904e5223550130d29 (patch)
tree9d42f5c6e12e81f402db79f603b4d2c466f27ede /usr.bin/ssh/readconf.c
parentensure hostname is lower-case before hashing it; bz#2591 reported by (diff)
downloadwireguard-openbsd-24f1039126c4a08aaa3b38e904e5223550130d29.tar.xz
wireguard-openbsd-24f1039126c4a08aaa3b38e904e5223550130d29.zip
better match sshd config parser behaviour: fatal() if line is overlong,
increase line buffer to match sshd's; bz#2651 reported by Don Fong; ok dtucker@
Diffstat (limited to 'usr.bin/ssh/readconf.c')
-rw-r--r--usr.bin/ssh/readconf.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/usr.bin/ssh/readconf.c b/usr.bin/ssh/readconf.c
index 1d53d1e648c..213048c8653 100644
--- a/usr.bin/ssh/readconf.c
+++ b/usr.bin/ssh/readconf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: readconf.c,v 1.269 2017/03/10 03:24:48 dtucker Exp $ */
+/* $OpenBSD: readconf.c,v 1.270 2017/03/10 04:27:32 djm Exp $ */
/*
* Author: Tatu Ylonen <ylo@cs.hut.fi>
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -1705,7 +1705,7 @@ read_config_file_depth(const char *filename, struct passwd *pw,
int flags, int *activep, int depth)
{
FILE *f;
- char line[1024];
+ char line[4096];
int linenum;
int bad_options = 0;
@@ -1735,6 +1735,8 @@ read_config_file_depth(const char *filename, struct passwd *pw,
while (fgets(line, sizeof(line), f)) {
/* 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++;