diff options
author | Jack Lloyd <[email protected]> | 2020-02-18 06:43:27 -0500 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2020-02-18 06:43:27 -0500 |
commit | 7e95eb153b2ba16764b0307b7aa429e53f5722ec (patch) | |
tree | 668a45308fd3cec879645e8aaf9307fe6606ed80 /src/lib/pubkey | |
parent | 39e9fffd6a44d7e868ac39c56f28d21cefcfb8e8 (diff) | |
parent | 88967ef754260947864d618fdbd86a873f6050d9 (diff) |
Merge GH #2277 Avoid double free in PKCS8::load_key under Clang 8
Diffstat (limited to 'src/lib/pubkey')
-rw-r--r-- | src/lib/pubkey/pkcs8.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/lib/pubkey/pkcs8.cpp b/src/lib/pubkey/pkcs8.cpp index 0238491dc..abb488af1 100644 --- a/src/lib/pubkey/pkcs8.cpp +++ b/src/lib/pubkey/pkcs8.cpp @@ -375,7 +375,9 @@ std::unique_ptr<Private_Key> load_key(DataSource& source, std::unique_ptr<Private_Key> load_key(DataSource& source, const std::string& pass) { - return load_key(source, [pass]() { return pass; }, true); + // We need to use bind rather than a lambda capturing `pass` here in order to avoid a Clang 8 bug. + // See https://github.com/randombit/botan/issues/2255. + return load_key(source, std::bind([](const std::string pass) { return pass; }, pass), true); } /* @@ -454,7 +456,9 @@ Private_Key* load_key(const std::string& fsname, { BOTAN_UNUSED(rng); DataSource_Stream in(fsname); - return PKCS8::load_key(in, [pass]() { return pass; }).release(); + // We need to use bind rather than a lambda capturing `pass` here in order to avoid a Clang 8 bug. + // See https://github.com/randombit/botan/issues/2255. + return PKCS8::load_key(in, std::bind([](const std::string pass) { return pass; }, pass)).release(); } /* |