Skip to content

Commit

Permalink
Fix TLS certificate allocation (#259)
Browse files Browse the repository at this point in the history
* Fix TLS certificate allocation

* change style + comment
  • Loading branch information
Menduist authored Jan 28, 2022
1 parent b47b2a9 commit 8719723
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion chronos/streams/tlsstream.nim
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 8719723

Please sign in to comment.