sanitizeShellString() and other security improvements
This commit is contained in:
parent
0be6fcd575
commit
01ef56cd58
@ -14,7 +14,6 @@
|
||||
// ----------------------------------------------------------------------------------
|
||||
|
||||
// const exec = require('child_process').exec;
|
||||
const execFile = require('child_process').execFile;
|
||||
const util = require('./util');
|
||||
|
||||
let _platform = process.platform;
|
||||
@ -213,9 +212,9 @@ function inetLatency(host, callback) {
|
||||
let result = null;
|
||||
try {
|
||||
const params = hostSanitized + ' -n 1';
|
||||
execFile('ping', params.split(' '), util.execOptsWin, function (error, stdout) {
|
||||
if (!error) {
|
||||
let lines = stdout.toString().split('\r\n');
|
||||
util.execSave('ping', params.split(' '), util.execOptsWin).then((stdout) => {
|
||||
if (stdout) {
|
||||
let lines = stdout.split('\r\n');
|
||||
lines.shift();
|
||||
lines.forEach(function (line) {
|
||||
if ((line.toLowerCase().match(/ms/g) || []).length === 3) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user