Skip to content

Commit

Permalink
worker: fix process.env var empty key access
Browse files Browse the repository at this point in the history
PR-URL: #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>
  • Loading branch information
bl-ue authored and BethGriggs committed Apr 28, 2020
1 parent a534d82 commit c84d802
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/node_env_var.cc
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ void MapKVStore::Set(Isolate* isolate, Local<String> key, Local<String> value) {
Mutex::ScopedLock lock(mutex_);
Utf8Value key_str(isolate, key);
Utf8Value value_str(isolate, value);
if (*key_str != nullptr && *value_str != nullptr) {
if (*key_str != nullptr && key_str.length() > 0 && *value_str != nullptr) {
map_[std::string(*key_str, key_str.length())] =
std::string(*value_str, value_str.length());
}
Expand Down

0 comments on commit c84d802

Please sign in to comment.