File tree 1 file changed +4
-3
lines changed
1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change 24
24
#include " stream_wrap.h"
25
25
#include " util-inl.h"
26
26
27
- #include < cstring >
27
+ #include < climits >
28
28
#include < cstdlib>
29
+ #include < cstring>
29
30
30
31
namespace node {
31
32
@@ -190,7 +191,7 @@ class ProcessWrap : public HandleWrap {
190
191
if (!argv_v.IsEmpty () && argv_v->IsArray ()) {
191
192
Local<Array> js_argv = argv_v.As <Array>();
192
193
int argc = js_argv->Length ();
193
- CHECK_GT (argc + 1 , 0 ); // Check for overflow.
194
+ CHECK_LT (argc, INT_MAX ); // Check for overflow.
194
195
195
196
// Heap allocate to detect errors. +1 is for nullptr.
196
197
options.args = new char *[argc + 1 ];
@@ -218,7 +219,7 @@ class ProcessWrap : public HandleWrap {
218
219
if (!env_v.IsEmpty () && env_v->IsArray ()) {
219
220
Local<Array> env_opt = env_v.As <Array>();
220
221
int envc = env_opt->Length ();
221
- CHECK_GT (envc + 1 , 0 ); // Check for overflow.
222
+ CHECK_LT (envc, INT_MAX); // Check for overflow.
222
223
options.env = new char *[envc + 1 ]; // Heap allocated to detect errors.
223
224
for (int i = 0 ; i < envc; i++) {
224
225
node::Utf8Value pair (env->isolate (),
You can’t perform that action at this time.
0 commit comments