Skip to content

Commit

Permalink
child_process: validate arguments for null bytes
Browse files Browse the repository at this point in the history
  • Loading branch information
codebytere committed Jan 9, 2023
1 parent 29a7070 commit 1d9dfac
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions patches/node/enable_crashpad_linux_node_processes.patch
Expand Up @@ -27,7 +27,7 @@ index 73c1dc769542865bdf7a2a03c16cef141d3f4b05..76151c75ef7ad420d2642c1cd11c8624
args = [...execArgv, modulePath, ...args];

if (typeof options.stdio === 'string') {
@@ -613,6 +613,21 @@ function normalizeSpawnArguments(file, args, options) {
@@ -624,6 +624,21 @@ function normalizeSpawnArguments(file, args, options) {
'options.windowsVerbatimArguments');
}

Expand All @@ -47,5 +47,5 @@ index 73c1dc769542865bdf7a2a03c16cef141d3f4b05..76151c75ef7ad420d2642c1cd11c8624
+ }
+
if (options.shell) {
validateArgumentNullCheck(options.shell, 'options.shell');
const command = ArrayPrototypeJoin([file, ...args], ' ');
// Set the shell, switches, and commands.
Expand Up @@ -7,13 +7,13 @@ Subject: refactor: alter child_process.fork to use execute script with
When forking a child script, we setup a special environment to make the Electron binary run like the upstream node. On Mac, we use the helper app as node binary.

diff --git a/lib/child_process.js b/lib/child_process.js
index 335de95ec06a9985821f3dbaee802ec319f1f013..73c1dc769542865bdf7a2a03c16cef141d3f4b05 100644
index 55e6b781cd00699921bf138b757fc3555942646b..d5800d07d2940cbbde793535c6d1d9cf15dba1b1 100644
--- a/lib/child_process.js
+++ b/lib/child_process.js
@@ -136,6 +136,16 @@ function fork(modulePath, args = [], options) {
validateObject(options, 'options');
@@ -138,6 +138,16 @@ function fork(modulePath, args = [], options) {
}
options = { ...options, shell: false };
options.execPath = options.execPath || process.execPath;
+
+ // When forking a child script, we setup a special environment to make
+ // the electron binary run like upstream Node.js
Expand All @@ -24,6 +24,6 @@ index 335de95ec06a9985821f3dbaee802ec319f1f013..73c1dc769542865bdf7a2a03c16cef14
+ options.execPath = process.helperExecPath;
+ }
+
options.execPath = options.execPath || process.execPath;
validateArgumentNullCheck(options.execPath, 'options.execPath');

// Prepare arguments for fork:

0 comments on commit 1d9dfac

Please sign in to comment.