=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/ssh/sshconnect2.c,v retrieving revision 1.289 retrieving revision 1.290 diff -u -r1.289 -r1.290 --- src/usr.bin/ssh/sshconnect2.c 2018/11/16 02:46:20 1.289 +++ src/usr.bin/ssh/sshconnect2.c 2018/11/28 06:00:38 1.290 @@ -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 @@ { 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 @@ 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 @@ (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,