xbar
xbar copied to clipboard
Using io.ReadAll(res.Body) is dangerous
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!