mirror of
https://github.com/minio/minio.git
synced 2025-01-11 15:03:22 -05:00
Add defensive check for one stream message size (#15029)
In a streaming response, the client knows the size of a streamed message but never checks the message size. Add the check to error out if the response message is truncated.
This commit is contained in:
parent
1fce2b180f
commit
d4e565e595
@ -1067,10 +1067,13 @@ func waitForHTTPStream(respBody io.ReadCloser, w io.Writer) error {
|
||||
return err
|
||||
}
|
||||
length := binary.LittleEndian.Uint32(tmp[:])
|
||||
_, err = io.CopyBuffer(w, io.LimitReader(respBody, int64(length)), buf)
|
||||
n, err := io.CopyBuffer(w, io.LimitReader(respBody, int64(length)), buf)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if n != int64(length) {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
continue
|
||||
case 32:
|
||||
continue
|
||||
|
Loading…
Reference in New Issue
Block a user