File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change 2424#include " stream_wrap.h"
2525#include " util-inl.h"
2626
27- #include < cstring >
27+ #include < climits >
2828#include < cstdlib>
29+ #include < cstring>
2930
3031namespace node {
3132
@@ -190,7 +191,7 @@ class ProcessWrap : public HandleWrap {
190191 if (!argv_v.IsEmpty () && argv_v->IsArray ()) {
191192 Local<Array> js_argv = argv_v.As <Array>();
192193 int argc = js_argv->Length ();
193- CHECK_GT (argc + 1 , 0 ); // Check for overflow.
194+ CHECK_LT (argc, INT_MAX ); // Check for overflow.
194195
195196 // Heap allocate to detect errors. +1 is for nullptr.
196197 options.args = new char *[argc + 1 ];
@@ -218,7 +219,7 @@ class ProcessWrap : public HandleWrap {
218219 if (!env_v.IsEmpty () && env_v->IsArray ()) {
219220 Local<Array> env_opt = env_v.As <Array>();
220221 int envc = env_opt->Length ();
221- CHECK_GT (envc + 1 , 0 ); // Check for overflow.
222+ CHECK_LT (envc, INT_MAX); // Check for overflow.
222223 options.env = new char *[envc + 1 ]; // Heap allocated to detect errors.
223224 for (int i = 0 ; i < envc; i++) {
224225 node::Utf8Value pair (env->isolate (),
You can’t perform that action at this time.
0 commit comments