diff --git a/cmd/mtredisalize/parser.go b/cmd/mtredisalize/parser.go index e54afa3..bd38351 100644 --- a/cmd/mtredisalize/parser.go +++ b/cmd/mtredisalize/parser.go @@ -13,6 +13,8 @@ import ( "strconv" ) +const maxBulkStringSize = 8 * 1024 * 1024 + type RedisConsumer interface { ConsumeInteger(int64) bool ConsumeArray(int64) bool @@ -92,7 +94,7 @@ 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 + if i > maxBulkStringSize { // prevent denial of service. return rp.consumer.ConsumeError( fmt.Errorf("Bulk string too large (%d bytes).\n", i)) }