|
|
@@ -23,7 +23,6 @@ import (
|
|
|
"errors"
|
|
|
"fmt"
|
|
|
"io"
|
|
|
- "io/ioutil"
|
|
|
"net"
|
|
|
|
|
|
"strconv"
|
|
|
@@ -481,11 +480,14 @@ func parseGetResponse(r *bufio.Reader, cb func(*Item)) error {
|
|
|
if err != nil {
|
|
|
return err
|
|
|
}
|
|
|
- it.Value, err = ioutil.ReadAll(io.LimitReader(r, int64(size)+2))
|
|
|
+ it.Value = make([]byte, size+2)
|
|
|
+ _, err = io.ReadFull(r, it.Value)
|
|
|
if err != nil {
|
|
|
+ it.Value = nil
|
|
|
return err
|
|
|
}
|
|
|
if !bytes.HasSuffix(it.Value, crlf) {
|
|
|
+ it.Value = nil
|
|
|
return fmt.Errorf("memcache: corrupt get result read")
|
|
|
}
|
|
|
it.Value = it.Value[:size]
|