summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDarren Tucker <dtucker@cvs.openbsd.org>2012-07-13 01:35:22 +0000
committerDarren Tucker <dtucker@cvs.openbsd.org>2012-07-13 01:35:22 +0000
commit5e13b6db2bd237242c283d5409fcdf868624d0f0 (patch)
tree025feca61952da39dc28ce127ab85584725f8ff7
parent60856b4aea8a60f5af37e079038da97007e59807 (diff)
handle long comments in config files better. bz#2025, ok markus
-rw-r--r--usr.bin/ssh/servconf.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/usr.bin/ssh/servconf.c b/usr.bin/ssh/servconf.c
index 79c3cbb3df1..04ba9e58038 100644
--- a/usr.bin/ssh/servconf.c
+++ b/usr.bin/ssh/servconf.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: servconf.c,v 1.228 2012/07/10 02:19:15 djm Exp $ */
+/* $OpenBSD: servconf.c,v 1.229 2012/07/13 01:35:21 dtucker Exp $ */
/*
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
* All rights reserved
@@ -1481,8 +1481,9 @@ process_server_config_line(ServerOptions *options, char *line,
void
load_server_config(const char *filename, Buffer *conf)
{
- char line[1024], *cp;
+ char line[4096], *cp;
FILE *f;
+ int lineno = 0;
debug2("%s: filename %s", __func__, filename);
if ((f = fopen(filename, "r")) == NULL) {
@@ -1491,6 +1492,9 @@ load_server_config(const char *filename, Buffer *conf)
}
buffer_clear(conf);
while (fgets(line, sizeof(line), f)) {
+ lineno++;
+ if (strlen(line) == sizeof(line) - 1)
+ fatal("%s line %d too long", filename, lineno);
/*
* Trim out comments and strip whitespace
* NB - preserve newlines, they are needed to reproduce