]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
crypt_ops: Stop using a separate buffer in ed25519_signature_from_base64()
authorteor <teor@torproject.org>
Fri, 12 Apr 2019 03:00:02 +0000 (13:00 +1000)
committerteor <teor@torproject.org>
Fri, 12 Apr 2019 03:00:02 +0000 (13:00 +1000)
Part of 29960.

src/lib/crypt_ops/crypto_format.c

index 1827168c7547b7a99cb689548f4ca4e39da547f8..e11b39119491867731b1ae8bc3d80955be5be4e0 100644 (file)
@@ -248,11 +248,9 @@ ed25519_signature_from_base64(ed25519_signature_t *sig,
 {
   if (strlen(input) != ED25519_SIG_BASE64_LEN)
     return -1;
-  char buf[ED25519_SIG_BASE64_LEN+1];
-  memcpy(buf, input, ED25519_SIG_BASE64_LEN);
-  buf[ED25519_SIG_BASE64_LEN] = 0;
   char decoded[128];
-  int n = base64_decode(decoded, sizeof(decoded), buf, strlen(buf));
+  int n = base64_decode(decoded, sizeof(decoded), input,
+                        ED25519_SIG_BASE64_LEN);
   if (n < 0 || n != ED25519_SIG_LEN)
     return -1;
   memcpy(sig->sig, decoded, ED25519_SIG_LEN);