summaryrefslogtreecommitdiffstats
path: root/crypto/hmac_win.cc
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/hmac_win.cc')
-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];