From cf40787371b31d3bdc759cec6ece090af00bf34b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A5kan=20Kvist?= Date: Thu, 25 Nov 2010 17:48:50 +0000 Subject: [PATCH] Allow spaces in passwords, #93 --- CHANGELOG | 2 ++ src/common.c | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 8852dc1..ab87cfd 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -31,6 +31,8 @@ CHANGES: - Resolve client nameserver argument if given as hostname, fixes #82. - Open log before chroot, fixes #86: logging on FreeBSD. - Fix DNS tunneling bug caused by uninitialized variable, #94 + - Handle spaces when entering password interactively, fixes #93. + Patch by Hagar. 2009-06-01: 0.5.2 "WifiFree" - Fixed client segfault on OS X, #57 diff --git a/src/common.c b/src/common.c index dd2bf2d..4ab93d9 100644 --- a/src/common.c +++ b/src/common.c @@ -219,7 +219,7 @@ do_detach() void read_password(char *buf, size_t len) { - char pwd[80]; + char pwd[80] = {0}; #ifndef WINDOWS32 struct termios old; struct termios tp; @@ -236,7 +236,7 @@ read_password(char *buf, size_t len) fprintf(stderr, "Enter password: "); fflush(stderr); #ifndef WINDOWS32 - scanf("%79s", pwd); + fscanf(stdin, "%79[^\n]", pwd); #else for (i = 0; i < sizeof(pwd); i++) { pwd[i] = getch();