Allow spaces in passwords, #93

This commit is contained in:
Håkan Kvist
2010-11-25 17:48:50 +00:00
committed by Erik Ekman
parent 0a968a5144
commit 9c3343e6ac
2 changed files with 4 additions and 2 deletions

View File

@@ -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();