sanitizeShellString() and other security improvements

This commit is contained in:
Sebastian Hildebrandt 2021-03-15 11:51:30 +01:00
parent 0be6fcd575
commit 01ef56cd58

View File

@ -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) {