xbar icon indicating copy to clipboard operation
xbar copied to clipboard

Using io.ReadAll(res.Body) is dangerous

Open tkandal opened this issue 4 years ago • 0 comments

Hello!

Excuse me, but using content, err := io.ReadAll(res.Body) is dangerous. A misbehaving service, compromised or fake service may send more data than expected and fill up loads of memory, maybe even crash your program and computer. This is easily prevented by using io.LimitReader(res.Body, limit), to set a maximum limit.

Have a very good day!

tkandal avatar Feb 05 '22 09:02 tkandal