diff options
Diffstat (limited to 'servconf.c')
-rw-r--r-- | servconf.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/servconf.c b/servconf.c index 3c41490b3..f55b66736 100644 --- a/servconf.c +++ b/servconf.c | |||
@@ -1,5 +1,5 @@ | |||
1 | 1 | ||
2 | /* $OpenBSD: servconf.c,v 1.330 2018/06/06 18:23:32 djm Exp $ */ | 2 | /* $OpenBSD: servconf.c,v 1.331 2018/06/06 18:29:18 markus Exp $ */ |
3 | /* | 3 | /* |
4 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland | 4 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland |
5 | * All rights reserved | 5 | * All rights reserved |
@@ -2103,7 +2103,8 @@ process_server_config_line(ServerOptions *options, char *line, | |||
2103 | void | 2103 | void |
2104 | load_server_config(const char *filename, Buffer *conf) | 2104 | load_server_config(const char *filename, Buffer *conf) |
2105 | { | 2105 | { |
2106 | char line[4096], *cp; | 2106 | char *line = NULL, *cp; |
2107 | size_t linesize = 0; | ||
2107 | FILE *f; | 2108 | FILE *f; |
2108 | int lineno = 0; | 2109 | int lineno = 0; |
2109 | 2110 | ||
@@ -2113,10 +2114,8 @@ load_server_config(const char *filename, Buffer *conf) | |||
2113 | exit(1); | 2114 | exit(1); |
2114 | } | 2115 | } |
2115 | buffer_clear(conf); | 2116 | buffer_clear(conf); |
2116 | while (fgets(line, sizeof(line), f)) { | 2117 | while (getline(&line, &linesize, f) != -1) { |
2117 | lineno++; | 2118 | lineno++; |
2118 | if (strlen(line) == sizeof(line) - 1) | ||
2119 | fatal("%s line %d too long", filename, lineno); | ||
2120 | /* | 2119 | /* |
2121 | * Trim out comments and strip whitespace | 2120 | * Trim out comments and strip whitespace |
2122 | * NB - preserve newlines, they are needed to reproduce | 2121 | * NB - preserve newlines, they are needed to reproduce |
@@ -2128,6 +2127,7 @@ load_server_config(const char *filename, Buffer *conf) | |||
2128 | 2127 | ||
2129 | buffer_append(conf, cp, strlen(cp)); | 2128 | buffer_append(conf, cp, strlen(cp)); |
2130 | } | 2129 | } |
2130 | free(line); | ||
2131 | buffer_append(conf, "\0", 1); | 2131 | buffer_append(conf, "\0", 1); |
2132 | fclose(f); | 2132 | fclose(f); |
2133 | debug2("%s: done config len = %d", __func__, buffer_len(conf)); | 2133 | debug2("%s: done config len = %d", __func__, buffer_len(conf)); |