summaryrefslogtreecommitdiff
path: root/src/node_env_var.cc
diff options
context:
space:
mode:
authorChristopher Beeson <christopher@bl-ue.com>2020-04-18 16:49:25 -0400
committerBeth Griggs <Bethany.Griggs@uk.ibm.com>2020-04-28 23:00:40 +0100
commitd10c2c69686d774a1e654f00fd05f8f6126d476a (patch)
tree0a0ecf24c1da3337ab5a8877195f82a41734df62 /src/node_env_var.cc
parentc84d802449f8b1082052ca46678861d17e06602e (diff)
downloadnode-new-d10c2c69686d774a1e654f00fd05f8f6126d476a.tar.gz
src: fix empty-named env var assertion failure
Setting an environment variable with an empty name on Windows resulted in an assertion failure, because it was checked for an '=' sign at the beginning without verifying the length was greater than 0. Fixes: https://github.com/nodejs/node/issues/32920 Refs: https://github.com/nodejs/node/pull/27310 PR-URL: https://github.com/nodejs/node/pull/32921 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: David Carlier <devnexen@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com> Reviewed-By: Zeyu Yang <himself65@outlook.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com>
Diffstat (limited to 'src/node_env_var.cc')
-rw-r--r--src/node_env_var.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/node_env_var.cc b/src/node_env_var.cc
index 9df5ca8220..8fed12367f 100644
--- a/src/node_env_var.cc
+++ b/src/node_env_var.cc
@@ -121,7 +121,7 @@ void RealEnvStore::Set(Isolate* isolate,
node::Utf8Value val(isolate, value);
#ifdef _WIN32
- if (key[0] == L'=') return;
+ if (key.length() > 0 && key[0] == L'=') return;
#endif
uv_os_setenv(*key, *val);
DateTimeConfigurationChangeNotification(isolate, key);