From 87197230779002a2bfa8642f0e2ae07e2349e304 Mon Sep 17 00:00:00 2001 From: Tanguy Date: Fri, 28 Jan 2022 12:46:15 +0100 Subject: [PATCH] Fix TLS certificate allocation (#259) * Fix TLS certificate allocation * change style + comment --- chronos/streams/tlsstream.nim | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/chronos/streams/tlsstream.nim b/chronos/streams/tlsstream.nim index f0b1ff9..54a652d 100644 --- a/chronos/streams/tlsstream.nim +++ b/chronos/streams/tlsstream.nim @@ -708,7 +708,8 @@ proc init*(tt: typedesc[TLSCertificate], ## ## This procedure initializes array of certificates from PEM encoded string. var items = pemDecode(data) - var res = TLSCertificate() + # storage needs to be big enough for input data + var res = TLSCertificate(storage: newSeqOfCap[byte](data.len)) for item in items: if item.name == "CERTIFICATE" and len(item.data) > 0: let offset = len(res.storage)