From 7f90635216851f6cb4bf3999e98b825f85d604f8 Mon Sep 17 00:00:00 2001 From: "markus@openbsd.org" Date: Wed, 6 Jun 2018 18:29:18 +0000 Subject: upstream: switch config file parsing to getline(3) as this avoids static limits noted by gerhard@; ok dtucker@, djm@ OpenBSD-Commit-ID: 6d702eabef0fa12e5a1d75c334a8c8b325298b5c --- misc.c | 27 +-------------------------- 1 file changed, 1 insertion(+), 26 deletions(-) (limited to 'misc.c') diff --git a/misc.c b/misc.c index 874dcc8a2..3e62320ab 100644 --- a/misc.c +++ b/misc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: misc.c,v 1.127 2018/03/12 00:52:01 djm Exp $ */ +/* $OpenBSD: misc.c,v 1.128 2018/06/06 18:29:18 markus Exp $ */ /* * Copyright (c) 2000 Markus Friedl. All rights reserved. * Copyright (c) 2005,2006 Damien Miller. All rights reserved. @@ -1005,31 +1005,6 @@ percent_expand(const char *string, ...) #undef EXPAND_MAX_KEYS } -/* - * Read an entire line from a public key file into a static buffer, discarding - * lines that exceed the buffer size. Returns 0 on success, -1 on failure. - */ -int -read_keyfile_line(FILE *f, const char *filename, char *buf, size_t bufsz, - u_long *lineno) -{ - while (fgets(buf, bufsz, f) != NULL) { - if (buf[0] == '\0') - continue; - (*lineno)++; - if (buf[strlen(buf) - 1] == '\n' || feof(f)) { - return 0; - } else { - debug("%s: %s line %lu exceeds size limit", __func__, - filename, *lineno); - /* discard remainder of line */ - while (fgetc(f) != '\n' && !feof(f)) - ; /* nothing */ - } - } - return -1; -} - int tun_open(int tun, int mode, char **ifname) { -- cgit v1.2.3