Limit length of bulk string to 4MB. That should really be enough for a Minetest block.

This commit is contained in:
Sascha L. Teichmann 2014-08-08 15:12:30 +02:00
parent 8dba5f5f3b
commit 829f251700
1 changed files with 4 additions and 0 deletions

View File

@ -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