summaryrefslogtreecommitdiff
path: root/usr.bin/ssh/sshconnect2.c
diff options
context:
space:
mode:
authorDamien Miller <djm@cvs.openbsd.org>2008-07-17 08:48:01 +0000
committerDamien Miller <djm@cvs.openbsd.org>2008-07-17 08:48:01 +0000
commit61270ea18853a393d38c2a3023e7f1b50a15c45e (patch)
tree2761f68e89717ce5581e17767498f5e461b50e12 /usr.bin/ssh/sshconnect2.c
parent25403a301097d2afaab3445ac7e11a885f9718df (diff)
strnvis preauth banner; pointed out by mpf@ ok markus@
Diffstat (limited to 'usr.bin/ssh/sshconnect2.c')
-rw-r--r--usr.bin/ssh/sshconnect2.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/usr.bin/ssh/sshconnect2.c b/usr.bin/ssh/sshconnect2.c
index cbaecfff749..3723abeb2c8 100644
--- a/usr.bin/ssh/sshconnect2.c
+++ b/usr.bin/ssh/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.
*
@@ -36,6 +36,7 @@
#include <signal.h>
#include <pwd.h>
#include <unistd.h>
+#include <vis.h>
#include "xmalloc.h"
#include "ssh.h"
@@ -370,14 +371,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);
}