Fix buffer overflow if server sends corrupt response to small