Skip to content

Commit

Permalink
crypto/attachment: Check dst bounds on encrypted read
Browse files Browse the repository at this point in the history
  • Loading branch information
Fizzadar committed Dec 12, 2024
1 parent 9593f72 commit bec2c1e
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions crypto/attachment/attachments.go
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,9 @@ func (r *encryptingReader) Seek(offset int64, whence int) (int64, error) {
}

func (r *encryptingReader) Read(dst []byte) (n int, err error) {
if len(dst) < n {
return 0, io.ErrUnexpectedEOF
}
if r.closed {
return 0, ReaderClosed
} else if r.isDecrypting && r.file.decoded == nil {
Expand Down

0 comments on commit bec2c1e

Please sign in to comment.