Protect readLine() against DoS

This commit is contained in:
pixeebot[bot] 2024-02-01 23:01:04 +00:00
parent 61cd473e6c
commit 450e090252

View file

@ -1,5 +1,6 @@
package stirling.software.SPDF.utils;
import io.github.pixee.security.BoundedLineReader;
import java.io.BufferedReader;
import java.io.File;
import java.io.IOException;
@ -109,7 +110,7 @@ public class ProcessExecutor {
process.getErrorStream(),
StandardCharsets.UTF_8))) {
String line;
while ((line = errorReader.readLine()) != null) {
while ((line = BoundedLineReader.readLine(errorReader, 5_000_000)) != null) {
errorLines.add(line);
if (liveUpdates) logger.info(line);
}
@ -130,7 +131,7 @@ public class ProcessExecutor {
process.getInputStream(),
StandardCharsets.UTF_8))) {
String line;
while ((line = outputReader.readLine()) != null) {
while ((line = BoundedLineReader.readLine(outputReader, 5_000_000)) != null) {
outputLines.add(line);
if (liveUpdates) logger.info(line);
}