summaryrefslogtreecommitdiffstats
path: root/crypto
diff options
context:
space:
mode:
authorgroby@chromium.org <groby@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-12-22 07:40:44 +0000
committergroby@chromium.org <groby@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-12-22 07:40:44 +0000
commitcfd607fb2faa705c9e5a6e8e3e07565890e21e2a (patch)
treef77e07f3cdc39f4b745ad3ba4d0646ba6107b6d5 /crypto
parent5b96836fc4993fd4e780ebf5a41f2a6863b0b552 (diff)
downloadchromium_src-cfd607fb2faa705c9e5a6e8e3e07565890e21e2a.zip
chromium_src-cfd607fb2faa705c9e5a6e8e3e07565890e21e2a.tar.gz
chromium_src-cfd607fb2faa705c9e5a6e8e3e07565890e21e2a.tar.bz2
Fixed bad pointer on edge case
CID=102090 TEST= Review URL: http://codereview.chromium.org/8965056 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@115499 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'crypto')
-rw-r--r--crypto/hmac_win.cc3
1 files changed, 2 insertions, 1 deletions
diff --git a/crypto/hmac_win.cc b/crypto/hmac_win.cc
index 3522bed..9109429 100644
--- a/crypto/hmac_win.cc
+++ b/crypto/hmac_win.cc
@@ -43,7 +43,8 @@ void ComputeHMACSHA256(const unsigned char* key, size_t key_len,
memset(key0 + SHA256_LENGTH, 0, SHA256_BLOCK_SIZE - SHA256_LENGTH);
} else {
memcpy(key0, key, key_len);
- memset(key0 + key_len, 0, SHA256_BLOCK_SIZE - key_len);
+ if (key_len < SHA256_BLOCK_SIZE)
+ memset(key0 + key_len, 0, SHA256_BLOCK_SIZE - key_len);
}
unsigned char padded_key[SHA256_BLOCK_SIZE];