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 <[email protected]>
Reviewed-By: David Carlier <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Franziska Hinkelmann <[email protected]>
Reviewed-By: Zeyu Yang <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Juan José Arboleda <[email protected]>
  • 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.