Fix invalid buffer length due to timeout in initial read.