Bugzilla – Attachment 2922 Details for
Bug 2651
ssh prints bogus error message if config file has very long lines
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
slight improvement to patch
longline.patch (text/plain), 2.32 KB, created by
don fong
on 2016-12-28 18:30:23 AEDT
(
hide
)
Description:
slight improvement to patch
Filename:
MIME Type:
Creator:
don fong
Created:
2016-12-28 18:30:23 AEDT
Size:
2.32 KB
patch
obsolete
>From 3e97ac59a9a09e11cfcc1b54f3b283a56063d036 Mon Sep 17 00:00:00 2001 >From: Don Fong <dfong@apigee.com> >Date: Fri, 23 Dec 2016 17:49:47 -0800 >Subject: [PATCH] issue error message for config file lines exceeding 1022 > chars. document the line length limitation in ssh_config(5). > >--- > readconf.c | 22 +++++++++++++++++++++- > ssh_config.5 | 3 +++ > 2 files changed, 24 insertions(+), 1 deletion(-) > >diff --git a/readconf.c b/readconf.c >index fa3fab8..57d49cf 100644 >--- a/readconf.c >+++ b/readconf.c >@@ -1693,6 +1693,12 @@ read_config_file(const char *filename, struct passwd *pw, const char *host, > options, flags, &active, 0); > } > >+#define IS_NEWLINE_TERMINATED(buf, bufsize) \ >+ (strlen(buf) < (bufsize)-1 || (buf)[(bufsize)-2] == '\n') >+ >+/* maximum line length excluding newline */ >+#define READCONF_MAX_LINE_LENGTH 1022 >+ > #define READCONF_MAX_DEPTH 16 > static int > read_config_file_depth(const char *filename, struct passwd *pw, >@@ -1700,7 +1706,7 @@ read_config_file_depth(const char *filename, struct passwd *pw, > int flags, int *activep, int depth) > { > FILE *f; >- char line[1024]; >+ char line[READCONF_MAX_LINE_LENGTH+2]; > int linenum; > int bad_options = 0; > >@@ -1730,6 +1736,20 @@ read_config_file_depth(const char *filename, struct passwd *pw, > while (fgets(line, sizeof(line), f)) { > /* Update line number counter. */ > linenum++; >+ >+ /* report error if config line won't fit in buffer */ >+ if (! IS_NEWLINE_TERMINATED(line, sizeof(line))) { >+ error("%s line %d: max line length %d exceeded", >+ filename, linenum, READCONF_MAX_LINE_LENGTH); >+ >+ /* eat and discard the rest of the line */ >+ while (fgets(line, sizeof(line), f) >+ && ! IS_NEWLINE_TERMINATED(line, sizeof(line))) >+ ; >+ bad_options++; >+ continue; >+ } >+ > if (process_config_line_depth(options, pw, host, original_host, > line, filename, linenum, activep, flags, depth) != 0) > bad_options++; >diff --git a/ssh_config.5 b/ssh_config.5 >index 591365f..880a27d 100644 >--- a/ssh_config.5 >+++ b/ssh_config.5 >@@ -59,6 +59,9 @@ system-wide configuration file > .Pq Pa /etc/ssh/ssh_config > .El > .Pp >+These configuration files are line-oriented text files >+with a maximum line length (excluding the newline) of 1022 bytes. >+.Pp > For each parameter, the first obtained value > will be used. > The configuration files contain sections separated by >-- >2.7.4 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 2651
:
2918
|
2919
| 2922 |
2923
|
2958