From 031a81f94351a95937ad52c6b8156feb0d9bd5c7 Mon Sep 17 00:00:00 2001 From: Damien Miller Date: Fri, 3 Feb 2017 05:05:57 +0000 Subject: allow form-feed characters at EOL; bz#2431 ok dtucker@ --- usr.bin/ssh/readconf.c | 6 +++--- usr.bin/ssh/servconf.c | 11 ++++++++++- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/usr.bin/ssh/readconf.c b/usr.bin/ssh/readconf.c index bccd0f3a5dc..e8f63e381e3 100644 --- a/usr.bin/ssh/readconf.c +++ b/usr.bin/ssh/readconf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: readconf.c,v 1.266 2017/01/30 00:38:50 djm Exp $ */ +/* $OpenBSD: readconf.c,v 1.267 2017/02/03 05:05:56 djm Exp $ */ /* * Author: Tatu Ylonen * Copyright (c) 1995 Tatu Ylonen , Espoo, Finland @@ -827,11 +827,11 @@ process_config_line_depth(Options *options, struct passwd *pw, const char *host, activep = &cmdline; } - /* Strip trailing whitespace */ + /* Strip trailing whitespace. Allow \f (form feed) at EOL only */ if ((len = strlen(line)) == 0) return 0; for (len--; len > 0; len--) { - if (strchr(WHITESPACE, line[len]) == NULL) + if (strchr(WHITESPACE "\f", line[len]) == NULL) break; line[len] = '\0'; } diff --git a/usr.bin/ssh/servconf.c b/usr.bin/ssh/servconf.c index 6412de7d9da..08e66a98690 100644 --- a/usr.bin/ssh/servconf.c +++ b/usr.bin/ssh/servconf.c @@ -1,5 +1,5 @@ -/* $OpenBSD: servconf.c,v 1.302 2017/01/06 03:45:41 djm Exp $ */ +/* $OpenBSD: servconf.c,v 1.303 2017/02/03 05:05:56 djm Exp $ */ /* * Copyright (c) 1995 Tatu Ylonen , Espoo, Finland * All rights reserved @@ -920,6 +920,15 @@ process_server_config_line(ServerOptions *options, char *line, long long val64; const struct multistate *multistate_ptr; + /* Strip trailing whitespace. Allow \f (form feed) at EOL only */ + if ((len = strlen(line)) == 0) + return 0; + for (len--; len > 0; len--) { + if (strchr(WHITESPACE "\f", line[len]) == NULL) + break; + line[len] = '\0'; + } + cp = line; if ((arg = strdelim(&cp)) == NULL) return 0; -- cgit v1.2.3