Skip to content

Commit 2d9b624

Browse files
aduh95danielleadams
authored andcommitted
tls: refactor to avoid unsafe array iteration
PR-URL: #37655 Reviewed-By: Darshan Sen <raisinten@gmail.com> Reviewed-By: Zijian Liu <lxxyxzj@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
1 parent 6688569 commit 2d9b624

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/_tls_common.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,8 @@ exports.createSecureContext = function createSecureContext(options) {
217217
// which leads to the crash later on.
218218
if (key) {
219219
if (ArrayIsArray(key)) {
220-
for (const val of key) {
220+
for (let i = 0; i < key.length; ++i) {
221+
const val = key[i];
221222
// eslint-disable-next-line eqeqeq
222223
const pem = (val != undefined && val.pem !== undefined ? val.pem : val);
223224
setKey(c.context, pem, val.passphrase || passphrase);

0 commit comments

Comments
 (0)