diff options
author | Damien Miller <djm@cvs.openbsd.org> | 2018-11-28 06:00:39 +0000 |
---|---|---|
committer | Damien Miller <djm@cvs.openbsd.org> | 2018-11-28 06:00:39 +0000 |
commit | 08571631097050b21fc0fa4bde17f65217816680 (patch) | |
tree | ff5bcf323c63718f189f37b50631e0ca8419e3c6 /usr.bin | |
parent | 8ca300f3c1f283b5f16afc6a654bc9b31aea6126 (diff) |
don't truncate user or host name in "user@host's password: " prompts.
requested by Marcel Logen; ok dtucker@
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/ssh/sshconnect2.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/usr.bin/ssh/sshconnect2.c b/usr.bin/ssh/sshconnect2.c index 5d647508c41..b3c1cff93d6 100644 --- a/usr.bin/ssh/sshconnect2.c +++ b/usr.bin/ssh/sshconnect2.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sshconnect2.c,v 1.289 2018/11/16 02:46:20 djm Exp $ */ +/* $OpenBSD: sshconnect2.c,v 1.290 2018/11/28 06:00:38 djm Exp $ */ /* * Copyright (c) 2000 Markus Friedl. All rights reserved. * Copyright (c) 2008 Damien Miller. All rights reserved. @@ -950,8 +950,7 @@ userauth_passwd(Authctxt *authctxt) { struct ssh *ssh = active_state; /* XXX */ static int attempt = 0; - char prompt[256]; - char *password; + char *password, *prompt = NULL; const char *host = options.host_key_alias ? options.host_key_alias : authctxt->host; int r; @@ -962,8 +961,7 @@ userauth_passwd(Authctxt *authctxt) if (attempt != 1) error("Permission denied, please try again."); - snprintf(prompt, sizeof(prompt), "%.30s@%.128s's password: ", - authctxt->server_user, host); + xasprintf(&prompt, "%s@%s's password: ", authctxt->server_user, host); password = read_passphrase(prompt, 0); if ((r = sshpkt_start(ssh, SSH2_MSG_USERAUTH_REQUEST)) != 0 || (r = sshpkt_put_cstring(ssh, authctxt->server_user)) != 0 || @@ -975,7 +973,8 @@ userauth_passwd(Authctxt *authctxt) (r = sshpkt_send(ssh)) != 0) fatal("%s: %s", __func__, ssh_err(r)); - if (password) + free(prompt); + if (password != NULL) freezero(password, strlen(password)); ssh_dispatch_set(ssh, SSH2_MSG_USERAUTH_PASSWD_CHANGEREQ, |