Commit 766cfece introduced this bug by defining an incorrect split
function. First it breaks the old behavior because it never splits at
newlines now. Second, it causes a panic because it never tells the
scanner to stop. See the bufio.ScanLines function, something like:
```
if atEOF && len(data) == 0 {
return 0, nil, nil
}
```
is needed to do that.
This commit fixes it by restoring the old behavior and calling
bufio.ScanLines but also keep the 64KB check in place to avoid buffering
for to long.
Two tests are added to ensure it is working as expected.
Fixes#1383
Signed-off-by: Paul Holzinger <pholzing@redhat.com>
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 adds a variant of the logger's Writer() function that
accepts a log level. When the variant is used, any messages written to
the returned pipe will be written with the provided level. The original
Writer() function uses the logger's Print() method as it always has.