diff options
author | markus@openbsd.org <markus@openbsd.org> | 2018-06-06 18:29:18 +0000 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 2018-06-07 04:34:05 +1000 |
commit | 7f90635216851f6cb4bf3999e98b825f85d604f8 (patch) | |
tree | ac302db18a71c1e3c5d9077d1a820e37fbc2b9b5 /misc.c | |
parent | 392db2bc83215986a91c0b65feb0e40e7619ce7e (diff) |
upstream: switch config file parsing to getline(3) as this avoids
static limits noted by gerhard@; ok dtucker@, djm@
OpenBSD-Commit-ID: 6d702eabef0fa12e5a1d75c334a8c8b325298b5c
Diffstat (limited to 'misc.c')
-rw-r--r-- | misc.c | 27 |
1 files changed, 1 insertions, 26 deletions
@@ -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) { |