aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/pubkey
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2020-02-18 06:43:27 -0500
committerJack Lloyd <[email protected]>2020-02-18 06:43:27 -0500
commit7e95eb153b2ba16764b0307b7aa429e53f5722ec (patch)
tree668a45308fd3cec879645e8aaf9307fe6606ed80 /src/lib/pubkey
parent39e9fffd6a44d7e868ac39c56f28d21cefcfb8e8 (diff)
parent88967ef754260947864d618fdbd86a873f6050d9 (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.cpp8
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();
}
/*