]> git.proxmox.com Git - proxmox-acme-rs.git/commitdiff
jws: allocate exact capacity
authorWolfgang Bumiller <w.bumiller@proxmox.com>
Wed, 17 Aug 2022 07:07:41 +0000 (09:07 +0200)
committerWolfgang Bumiller <w.bumiller@proxmox.com>
Wed, 17 Aug 2022 07:07:41 +0000 (09:07 +0200)
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
src/jws.rs

index e61ff69baa055815372450c77de4a4357a5c8bb7..b867f714b3efdd6829b3df7e0e306807da5128c5 100644 (file)
@@ -158,7 +158,7 @@ impl Jws {
             openssl::ecdsa::EcdsaSig::sign(hasher.finish()?.as_ref(), key.ec_key()?.as_ref())?;
         let r = sig.r().to_vec();
         let s = sig.s().to_vec();
-        let mut out = Vec::with_capacity(r.len() + s.len());
+        let mut out = Vec::with_capacity(ec_order_bytes * 2);
         out.extend(std::iter::repeat(0u8).take(ec_order_bytes - r.len()));
         out.extend(r);
         out.extend(std::iter::repeat(0u8).take(ec_order_bytes - s.len()));