ReadAll reads from r until EOF and returns the data. If r produces more
than max bytes, it returns an error instead of a silently truncated
slice. Use this in preference to io.ReadAll(io.LimitReader(r, max))
when callers must distinguish a complete read from a truncated one.