Skip to content

Commit

Permalink
tls: refactor to avoid unsafe array iteration
Browse files Browse the repository at this point in the history
PR-URL: #37655
Reviewed-By: Darshan Sen <[email protected]>
Reviewed-By: Zijian Liu <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
  • Loading branch information
aduh95 authored and danielleadams committed Mar 16, 2021
1 parent 6688569 commit 2d9b624
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/_tls_common.js
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,8 @@ exports.createSecureContext = function createSecureContext(options) {
// which leads to the crash later on.
if (key) {
if (ArrayIsArray(key)) {
for (const val of key) {
for (let i = 0; i < key.length; ++i) {
const val = key[i];
// eslint-disable-next-line eqeqeq
const pem = (val != undefined && val.pem !== undefined ? val.pem : val);
setKey(c.context, pem, val.passphrase || passphrase);
Expand Down

0 comments on commit 2d9b624

Please sign in to comment.