From 1071cb9bca3ff793ee0c92876fbab89dd03d54fd Mon Sep 17 00:00:00 2001 From: Daniel Huigens Date: Mon, 5 Nov 2018 16:30:47 +0100 Subject: [PATCH] Fix cloning embedded signatures --- src/packet/packetlist.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/packet/packetlist.js b/src/packet/packetlist.js index d85c2382..b56c2cd2 100644 --- a/src/packet/packetlist.js +++ b/src/packet/packetlist.js @@ -226,11 +226,15 @@ List.prototype.concat = function (packetlist) { List.fromStructuredClone = function(packetlistClone) { const packetlist = new List(); for (let i = 0; i < packetlistClone.length; i++) { - packetlist.push(packets.fromStructuredClone(packetlistClone[i])); - if (packetlist[i].packets.length !== 0) { - packetlist[i].packets = this.fromStructuredClone(packetlist[i].packets); + const packet = packets.fromStructuredClone(packetlistClone[i]); + packetlist.push(packet); + if (packet.embeddedSignature) { + packet.embeddedSignature = packets.fromStructuredClone(packet.embeddedSignature); + } + if (packet.packets.length !== 0) { + packet.packets = this.fromStructuredClone(packet.packets); } else { - packetlist[i].packets = new List(); + packet.packets = new List(); } } return packetlist;