Browse Source

Do not leak the 'tag' when trying to read a truncated ed25519 key file

Fix for bug 18956.
Nick Mathewson 8 years ago
parent
commit
ec81329339
2 changed files with 7 additions and 0 deletions
  1. 5 0
      changes/bug18956
  2. 2 0
      src/common/crypto_ed25519.c

+ 5 - 0
changes/bug18956

@@ -0,0 +1,5 @@
+  o Minor bugfixes (memory leaks):
+    - Fix a small, uncommon memory leak that could occur when reading a
+      truncated ed25519 key file. Fixes bug 18956; bugfix on 0.2.6.1-alpha.
+
+

+ 2 - 0
src/common/crypto_ed25519.c

@@ -433,6 +433,7 @@ ed25519_seckey_read_from_file(ed25519_secret_key_t *seckey_out,
     errno = EINVAL;
   }
 
+  tor_free(*tag_out);
   return -1;
 }
 
@@ -472,6 +473,7 @@ ed25519_pubkey_read_from_file(ed25519_public_key_t *pubkey_out,
     errno = EINVAL;
   }
 
+  tor_free(*tag_out);
   return -1;
 }