From 829f251700853c837cad8e67d1caced1de550d41 Mon Sep 17 00:00:00 2001 From: "Sascha L. Teichmann" Date: Fri, 8 Aug 2014 15:12:30 +0200 Subject: [PATCH] Limit length of bulk string to 4MB. That should really be enough for a Minetest block. --- parser.go | 4 ++++ 1 file changed, 4 insertions(+) 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