| Index: components/gcm_driver/crypto/gcm_message_cryptographer.cc
|
| diff --git a/components/gcm_driver/crypto/gcm_message_cryptographer.cc b/components/gcm_driver/crypto/gcm_message_cryptographer.cc
|
| index deaaba33a50f9981729e08e219c3aec98434e3b9..fb72d73dcfb303707a2142d2d9ba1efd98676179 100644
|
| --- a/components/gcm_driver/crypto/gcm_message_cryptographer.cc
|
| +++ b/components/gcm_driver/crypto/gcm_message_cryptographer.cc
|
| @@ -57,10 +57,8 @@ class WebPushEncryptionDraft03
|
| const base::StringPiece& auth_secret) override {
|
| const char kInfo[] = "Content-Encoding: auth";
|
|
|
| - std::string info;
|
| - info.reserve(sizeof(kInfo) + 1);
|
| - info.append(kInfo);
|
| - info.append(1, '\0');
|
| + // This deliberately copies over the NUL terminus.
|
| + base::StringPiece info(kInfo, sizeof(kInfo));
|
|
|
| crypto::HKDF hkdf(ecdh_shared_secret, auth_secret, info,
|
| 32, /* key_bytes_to_generate */
|
| @@ -197,9 +195,10 @@ class WebPushEncryptionDraft08
|
| const char kInfo[] = "WebPush: info";
|
|
|
| std::string info;
|
| - info.reserve(sizeof(kInfo) + 1 + 65 + 65);
|
| - info.append(kInfo);
|
| - info.append(1, '\0');
|
| + info.reserve(sizeof(kInfo) + 65 + 65);
|
| +
|
| + // This deliberately copies over the NUL terminus.
|
| + info.append(kInfo, sizeof(kInfo));
|
|
|
| recipient_public_key.AppendToString(&info);
|
| sender_public_key.AppendToString(&info);
|
|
|