Skip to content

Commit

Permalink
fix: Bug reading password from a buffer when reader returns EOF (back…
Browse files Browse the repository at this point in the history
  • Loading branch information
mergify[bot] authored and JeancarloBarrios committed Sep 28, 2024
1 parent 5feae4c commit 63e729e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ Ref: https://keepachangelog.com/en/1.0.0/

### Bug Fixes

* [#11796](https://github.com/cosmos/cosmos-sdk/pull/11796) Handle EOF error case in `readLineFromBuf`, which allows successful reading of passphrases from STDIN.
* [\#11772](https://github.com/cosmos/cosmos-sdk/pull/11772) Limit types.Dec length to avoid overflow.

## [v0.45.4](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.45.4) - 2022-04-25
Expand Down
3 changes: 2 additions & 1 deletion client/input/input_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func TestReadLineFromBuf(t *testing.T) {
require.ErrorIs(t, err, io.EOF)
})

t.Run("it returns the error if it's not EOF regardless if it read something or not", func(t *testing.T) {
t.Run("it returns the error if it's not EOF regardles if it read something or not", func(t *testing.T) {
expectedErr := errors.New("oh no")
fr.fnc = func(p []byte) (int, error) {
return copy(p, []byte("hello")), expectedErr
Expand All @@ -53,4 +53,5 @@ func TestReadLineFromBuf(t *testing.T) {
_, err := readLineFromBuf(buf)
require.ErrorIs(t, err, expectedErr)
})

}

0 comments on commit 63e729e

Please sign in to comment.