=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/ssh/servconf.c,v retrieving revision 1.330 retrieving revision 1.331 diff -u -r1.330 -r1.331 --- src/usr.bin/ssh/servconf.c 2018/06/06 18:23:32 1.330 +++ src/usr.bin/ssh/servconf.c 2018/06/06 18:29:18 1.331 @@ -1,5 +1,5 @@ -/* $OpenBSD: servconf.c,v 1.330 2018/06/06 18:23:32 djm Exp $ */ +/* $OpenBSD: servconf.c,v 1.331 2018/06/06 18:29:18 markus Exp $ */ /* * Copyright (c) 1995 Tatu Ylonen , Espoo, Finland * All rights reserved @@ -2040,7 +2040,8 @@ void load_server_config(const char *filename, Buffer *conf) { - char line[4096], *cp; + char *line = NULL, *cp; + size_t linesize = 0; FILE *f; int lineno = 0; @@ -2050,10 +2051,8 @@ exit(1); } buffer_clear(conf); - while (fgets(line, sizeof(line), f)) { + while (getline(&line, &linesize, f) != -1) { 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 @@ -2065,6 +2064,7 @@ buffer_append(conf, cp, strlen(cp)); } + free(line); buffer_append(conf, "\0", 1); fclose(f); debug2("%s: done config len = %d", __func__, buffer_len(conf));