Index: crypto/rsa_private_key_openssl.cc |
diff --git a/crypto/rsa_private_key_openssl.cc b/crypto/rsa_private_key_openssl.cc |
index 0df173093ad9237faac9b94e30369fbd054e5ffe..3dcce675a010b8ae837e74e8f4bdfc57917e7fc1 100644 |
--- a/crypto/rsa_private_key_openssl.cc |
+++ b/crypto/rsa_private_key_openssl.cc |
@@ -83,13 +83,10 @@ RSAPrivateKey* RSAPrivateKey::CreateFromPrivateKeyInfo( |
// Importing is a little more involved than exporting, as we must first |
// PKCS#8 decode the input, and then import the EVP_PKEY from Private Key |
// Info structure returned. |
- // |
- // TODO(davidben): This should check that |ptr| advanced to the end of |input| |
- // to ensure there is no trailing data. |
const uint8_t* ptr = &input[0]; |
ScopedPKCS8_PRIV_KEY_INFO p8inf( |
d2i_PKCS8_PRIV_KEY_INFO(nullptr, &ptr, input.size())); |
- if (!p8inf.get()) |
+ if (!p8inf.get() || ptr != &input[0] + input.size()) |
return NULL; |
scoped_ptr<RSAPrivateKey> result(new RSAPrivateKey); |