Skip to content

Commit 81a4b86

Browse files
committed
Remove untrusted input to exec
1 parent cfc96ba commit 81a4b86

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

utils/find-opencv.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22

33
var exec = require("child_process").exec;
44
var fs = require("fs");
5-
var flag = process.argv[2] || "--exists";
5+
var flag = "--exists";
66

77
// Normally |pkg-config opencv ...| could report either OpenCV 2.x or OpenCV 3.y
88
// depending on what is installed. To enable both 2.x and 3.y to co-exist on
99
// the same machine, the opencv.pc for 3.y can be installed as opencv3.pc and
1010
// then selected by |export PKG_CONFIG_OPENCV3=1| before building node-opencv.
11-
var opencv = process.env.PKG_CONFIG_OPENCV3 === "1" ? "opencv3" : '"opencv >= 2.3.1"';
11+
var opencv = process.env.PKG_CONFIG_OPENCV3 === "1" ? "opencv3" : ' "opencv >= 2.3.1"';
1212

1313
function main(){
1414
//Try using pkg-config, but if it fails and it is on Windows, try the fallback
@@ -18,7 +18,7 @@ function main(){
1818
fallback();
1919
}
2020
else{
21-
throw new Error("ERROR: failed to run: pkg-config", opencv, flag);
21+
throw new Error("ERROR: failed to run: pkg-config" + opencv + " " + flag + " - Is OpenCV installed?");
2222
}
2323
}
2424
else{

0 commit comments

Comments
 (0)