Skip to content

Commit

Permalink
tls: refactor to avoid unsafe array iteration
Browse files Browse the repository at this point in the history
  • Loading branch information
aduh95 committed Mar 8, 2021
1 parent 4811210 commit fe358f9
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 fe358f9

Please sign in to comment.