go.crypto/ssh/terminal: remove \r from passwords on Windows.
Fixes golang/go#9040. (Note: can't compile or test this one prior to committing.) LGTM=iant, bradfitz R=bradfitz, mathias.gumz, iant CC=golang-codereviews https://golang.org/cl/171000043
This commit is contained in:
@@ -161,6 +161,9 @@ func ReadPassword(fd int) ([]byte, error) {
|
|||||||
if buf[n-1] == '\n' {
|
if buf[n-1] == '\n' {
|
||||||
n--
|
n--
|
||||||
}
|
}
|
||||||
|
if n > 0 && buf[n-1] == '\r' {
|
||||||
|
n--
|
||||||
|
}
|
||||||
ret = append(ret, buf[:n]...)
|
ret = append(ret, buf[:n]...)
|
||||||
if n < len(buf) {
|
if n < len(buf) {
|
||||||
break
|
break
|
||||||
|
|||||||
Reference in New Issue
Block a user