Remove untrusted input to exec

This commit is contained in:
Peter Braden 2019-03-20 08:45:23 +00:00
parent cfc96ba0af
commit 81a4b86201

View File

@ -2,7 +2,7 @@
var exec = require("child_process").exec; var exec = require("child_process").exec;
var fs = require("fs"); var fs = require("fs");
var flag = process.argv[2] || "--exists"; var flag = "--exists";
// Normally |pkg-config opencv ...| could report either OpenCV 2.x or OpenCV 3.y // Normally |pkg-config opencv ...| could report either OpenCV 2.x or OpenCV 3.y
// depending on what is installed. To enable both 2.x and 3.y to co-exist on // depending on what is installed. To enable both 2.x and 3.y to co-exist on
@ -18,7 +18,7 @@ function main(){
fallback(); fallback();
} }
else{ else{
throw new Error("ERROR: failed to run: pkg-config", opencv, flag); throw new Error("ERROR: failed to run: pkg-config" + opencv + " " + flag + " - Is OpenCV installed?");
} }
} }
else{ else{