Scan text in 64KB chunks
This commit fixes a potential denial of service vulnerability in logrus.Writer() that could be triggered by logging text longer than 64KB without newlines. Previously, the bufio.Scanner used by Writer() would hang indefinitely when reading such text without newlines, causing the application to become unresponsive.
This commit is contained in:
@@ -75,7 +75,8 @@ func (entry *Entry) writerScanner(reader *io.PipeReader, printFunc func(args ...
|
|||||||
if len(data) > chunkSize {
|
if len(data) > chunkSize {
|
||||||
return chunkSize, data[:chunkSize], nil
|
return chunkSize, data[:chunkSize], nil
|
||||||
}
|
}
|
||||||
return 0, nil, nil
|
|
||||||
|
return len(data), data, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
//Use the custom split function to split the input
|
//Use the custom split function to split the input
|
||||||
|
|||||||
Reference in New Issue
Block a user