Skip to content

Commit ebb750e

Browse files
huntr.dev | the place to protect open sourcezpbrentgaearon
authored andcommitted
Security Fix for Command Injection - huntr.dev (facebook#10644)
* Update getProcessForPort.js * Update getProcessForPort.js Co-authored-by: Zhou Peng <zpbrent@gmail.com> Co-authored-by: Dan Abramov <dan.abramov@gmail.com>
1 parent 4e008a6 commit ebb750e

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

packages/react-dev-utils/getProcessForPort.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
var chalk = require('chalk');
1111
var execSync = require('child_process').execSync;
12+
var execFileSync = require('child_process').execFileSync;
1213
var path = require('path');
1314

1415
var execOptions = {
@@ -25,7 +26,7 @@ function isProcessAReactApp(processCommand) {
2526
}
2627

2728
function getProcessIdOnPort(port) {
28-
return execSync('lsof -i:' + port + ' -P -t -sTCP:LISTEN', execOptions)
29+
return execFileSync('lsof', ['-i:' + port, '-P', '-t', '-sTCP:LISTEN'], execOptions)
2930
.split('\n')[0]
3031
.trim();
3132
}

0 commit comments

Comments
 (0)