diff options
author | Damien Miller <djm@mindrot.org> | 2008-07-17 10:57:06 +0200 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 2008-07-17 10:57:06 +0200 |
commit | 7ba0ca7f6fa0c517822051412cf9f0e7b35304d4 (patch) | |
tree | 6b0e7b95b0840ed7681c6206be9b57d4b2db5cd4 /sshconnect2.c | |
parent | - djm@cvs.openbsd.org 2008/07/16 11:52:19 (diff) | |
download | openssh-7ba0ca7f6fa0c517822051412cf9f0e7b35304d4.tar.xz openssh-7ba0ca7f6fa0c517822051412cf9f0e7b35304d4.zip |
- djm@cvs.openbsd.org 2008/07/17 08:48:00
[sshconnect2.c]
strnvis preauth banner; pointed out by mpf@ ok markus@
Diffstat (limited to 'sshconnect2.c')
-rw-r--r-- | sshconnect2.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/sshconnect2.c b/sshconnect2.c index 5bb772368..067fad545 100644 --- a/sshconnect2.c +++ b/sshconnect2.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sshconnect2.c,v 1.165 2008/01/19 23:09:49 djm Exp $ */ +/* $OpenBSD: sshconnect2.c,v 1.166 2008/07/17 08:48:00 djm Exp $ */ /* * Copyright (c) 2000 Markus Friedl. All rights reserved. * @@ -38,6 +38,7 @@ #include <stdio.h> #include <string.h> #include <unistd.h> +#include <vis.h> #include "openbsd-compat/sys-queue.h" @@ -374,14 +375,21 @@ input_userauth_error(int type, u_int32_t seq, void *ctxt) void input_userauth_banner(int type, u_int32_t seq, void *ctxt) { - char *msg, *lang; + char *msg, *raw, *lang; + u_int len; debug3("input_userauth_banner"); - msg = packet_get_string(NULL); + raw = packet_get_string(&len); lang = packet_get_string(NULL); - if (options.log_level >= SYSLOG_LEVEL_INFO) + if (options.log_level >= SYSLOG_LEVEL_INFO) { + if (len > 65536) + len = 65536; + msg = xmalloc(len * 4); /* max expansion from strnvis() */ + strnvis(msg, raw, len * 4, VIS_SAFE|VIS_OCTAL); fprintf(stderr, "%s", msg); - xfree(msg); + xfree(msg); + } + xfree(raw); xfree(lang); } |