summaryrefslogtreecommitdiff
path: root/sshconnect2.c
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2008-07-17 18:57:06 +1000
committerDamien Miller <djm@mindrot.org>2008-07-17 18:57:06 +1000
commit7ba0ca7f6fa0c517822051412cf9f0e7b35304d4 (patch)
tree6b0e7b95b0840ed7681c6206be9b57d4b2db5cd4 /sshconnect2.c
parent6ef17495e9c867ef01860a7c97fc1f24ef7aa8db (diff)
- 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.c18
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 @@
1/* $OpenBSD: sshconnect2.c,v 1.165 2008/01/19 23:09:49 djm Exp $ */ 1/* $OpenBSD: sshconnect2.c,v 1.166 2008/07/17 08:48:00 djm Exp $ */
2/* 2/*
3 * Copyright (c) 2000 Markus Friedl. All rights reserved. 3 * Copyright (c) 2000 Markus Friedl. All rights reserved.
4 * 4 *
@@ -38,6 +38,7 @@
38#include <stdio.h> 38#include <stdio.h>
39#include <string.h> 39#include <string.h>
40#include <unistd.h> 40#include <unistd.h>
41#include <vis.h>
41 42
42#include "openbsd-compat/sys-queue.h" 43#include "openbsd-compat/sys-queue.h"
43 44
@@ -374,14 +375,21 @@ input_userauth_error(int type, u_int32_t seq, void *ctxt)
374void 375void
375input_userauth_banner(int type, u_int32_t seq, void *ctxt) 376input_userauth_banner(int type, u_int32_t seq, void *ctxt)
376{ 377{
377 char *msg, *lang; 378 char *msg, *raw, *lang;
379 u_int len;
378 380
379 debug3("input_userauth_banner"); 381 debug3("input_userauth_banner");
380 msg = packet_get_string(NULL); 382 raw = packet_get_string(&len);
381 lang = packet_get_string(NULL); 383 lang = packet_get_string(NULL);
382 if (options.log_level >= SYSLOG_LEVEL_INFO) 384 if (options.log_level >= SYSLOG_LEVEL_INFO) {
385 if (len > 65536)
386 len = 65536;
387 msg = xmalloc(len * 4); /* max expansion from strnvis() */
388 strnvis(msg, raw, len * 4, VIS_SAFE|VIS_OCTAL);
383 fprintf(stderr, "%s", msg); 389 fprintf(stderr, "%s", msg);
384 xfree(msg); 390 xfree(msg);
391 }
392 xfree(raw);
385 xfree(lang); 393 xfree(lang);
386} 394}
387 395