Skip to content

Commit c052ba6

Browse files
ozfiveashmckenzie
authored andcommitted
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.
1 parent 766cfec commit c052ba6

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Diff for: writer.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,8 @@ func (entry *Entry) writerScanner(reader *io.PipeReader, printFunc func(args ...
7575
if len(data) > chunkSize {
7676
return chunkSize, data[:chunkSize], nil
7777
}
78-
return 0, nil, nil
78+
79+
return len(data), data, nil
7980
}
8081

8182
//Use the custom split function to split the input

0 commit comments

Comments
 (0)