Fix output size check (#744)

This commit is contained in:
Lukas Larsson 2021-06-04 15:57:51 +02:00 committed by GitHub
parent 152627dfcb
commit 0a83e598dd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -30,7 +30,8 @@ export async function execute(
}
export function stdout(data: Buffer | string): void {
if (output.length < buffer.constants.MAX_STRING_LENGTH) {
output += data.toString().trim()
const dataString = data.toString().trim()
if (output.length + dataString.length < buffer.constants.MAX_STRING_LENGTH) {
output += dataString
}
}