diff --git a/parser.go b/parser.go index 7b8dee2..c889790 100644 --- a/parser.go +++ b/parser.go @@ -92,6 +92,10 @@ func (rp *RedisParser) bulkString(line []byte) bool { case i == 0: return rp.consumer.ConsumeBulkString([]byte{}) default: + if i >= 4*1024*1024 { // 4MB should be sufficient + return rp.consumer.ConsumeError( + fmt.Errorf("Bulk string too large (%d bytes).\n", i)) + } data := make([]byte, i, i) for rest := i; rest > 0; { var n int