View | Details | Raw Unified | Return to bug 2651 | Differences between
and this patch

Collapse All | Expand All

(-)a/readconf.c (-1 / +21 lines)
Lines 1693-1698 read_config_file(const char *filename, struct passwd *pw, const char *host, Link Here
1693
	    options, flags, &active, 0);
1693
	    options, flags, &active, 0);
1694
}
1694
}
1695
1695
1696
#define IS_NEWLINE_TERMINATED(buf, bufsize) \
1697
	(strlen(buf) < (bufsize)-1 || buf[(bufsize)-2] == '\n')
1698
1699
/* maximum line length excluding newline */
1700
#define READCONF_MAX_LINE_LENGTH 1022
1701
1696
#define READCONF_MAX_DEPTH	16
1702
#define READCONF_MAX_DEPTH	16
1697
static int
1703
static int
1698
read_config_file_depth(const char *filename, struct passwd *pw,
1704
read_config_file_depth(const char *filename, struct passwd *pw,
Lines 1700-1706 read_config_file_depth(const char *filename, struct passwd *pw, Link Here
1700
    int flags, int *activep, int depth)
1706
    int flags, int *activep, int depth)
1701
{
1707
{
1702
	FILE *f;
1708
	FILE *f;
1703
	char line[1024];
1709
	char line[READCONF_MAX_LINE_LENGTH+2];
1704
	int linenum;
1710
	int linenum;
1705
	int bad_options = 0;
1711
	int bad_options = 0;
1706
1712
Lines 1730-1735 read_config_file_depth(const char *filename, struct passwd *pw, Link Here
1730
	while (fgets(line, sizeof(line), f)) {
1736
	while (fgets(line, sizeof(line), f)) {
1731
		/* Update line number counter. */
1737
		/* Update line number counter. */
1732
		linenum++;
1738
		linenum++;
1739
1740
		/* report error if config line won't fit in buffer */
1741
		if (! IS_NEWLINE_TERMINATED(line, sizeof(line))) {
1742
			error("%s line %d: max line length %d exceeded",
1743
			      filename, linenum, READCONF_MAX_LINE_LENGTH);
1744
1745
			/* eat and discard the rest of the line */
1746
			while (fgets(line, sizeof(line), f)
1747
			 && ! IS_NEWLINE_TERMINATED(line, sizeof(line)))
1748
				;
1749
			bad_options++;
1750
			continue;
1751
		}
1752
1733
		if (process_config_line_depth(options, pw, host, original_host,
1753
		if (process_config_line_depth(options, pw, host, original_host,
1734
		    line, filename, linenum, activep, flags, depth) != 0)
1754
		    line, filename, linenum, activep, flags, depth) != 0)
1735
			bad_options++;
1755
			bad_options++;
(-)a/ssh_config.5 (-1 / +3 lines)
Lines 59-64 system-wide configuration file Link Here
59
.Pq Pa /etc/ssh/ssh_config
59
.Pq Pa /etc/ssh/ssh_config
60
.El
60
.El
61
.Pp
61
.Pp
62
These configuration files are line-oriented text files
63
with a maximum line length (excluding the newline) of 1022 bytes.
64
.Pp
62
For each parameter, the first obtained value
65
For each parameter, the first obtained value
63
will be used.
66
will be used.
64
The configuration files contain sections separated by
67
The configuration files contain sections separated by
65
- 

Return to bug 2651