From 1ed47d3f33f2315ac7647a3cbb615a1f9095a529 Mon Sep 17 00:00:00 2001 From: Dmitry Tsvettsikh Date: Sat, 18 Feb 2017 17:12:22 +0500 Subject: [PATCH] tty: avoid oob warning in TTYWrap::GetWindowSize() PR-URL: https://github.com/nodejs/node/pull/11454 Reviewed-By: James M Snell Reviewed-By: Anna Henningsen --- lib/tty.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/tty.js b/lib/tty.js index 576144e401..f9b8a34e95 100644 --- a/lib/tty.js +++ b/lib/tty.js @@ -55,7 +55,7 @@ function WriteStream(fd) { // Ref: https://github.com/nodejs/node/pull/1771#issuecomment-119351671 this._handle.setBlocking(process.env.NODE_TTY_UNSAFE_ASYNC !== '1'); - var winSize = []; + var winSize = new Array(2); var err = this._handle.getWindowSize(winSize); if (!err) { this.columns = winSize[0]; @@ -72,7 +72,7 @@ WriteStream.prototype.isTTY = true; WriteStream.prototype._refreshSize = function() { var oldCols = this.columns; var oldRows = this.rows; - var winSize = []; + var winSize = new Array(2); var err = this._handle.getWindowSize(winSize); if (err) { this.emit('error', errnoException(err, 'getWindowSize'));