From ef63af6006decaa82fc67b484a6404f2817b77cf Mon Sep 17 00:00:00 2001 From: Dmitry Tsvettsikh <dmitrycvet@gmail.com> 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 <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> --- lib/tty.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/tty.js b/lib/tty.js index 54a7b756ec9544..c00f2f5e796b34 100644 --- a/lib/tty.js +++ b/lib/tty.js @@ -66,7 +66,7 @@ function WriteStream(fd) { // Ref: https://github.com/nodejs/node/pull/1771#issuecomment-119351671 if (process.platform === 'darwin') this._handle.setBlocking(true); - var winSize = []; + var winSize = new Array(2); var err = this._handle.getWindowSize(winSize); if (!err) { this.columns = winSize[0]; @@ -83,7 +83,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'));