Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(205)

Unified Diff: crypto/ghash.cc

Issue 19619003: net: fix buffer overflow in GHASH. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | crypto/ghash_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: crypto/ghash.cc
diff --git a/crypto/ghash.cc b/crypto/ghash.cc
index 939dd0b86bcdbe27d0915a8f03abb889dc2c445b..5b28c442b89fe36878873ea45297cce8eba86534 100644
--- a/crypto/ghash.cc
+++ b/crypto/ghash.cc
@@ -229,7 +229,7 @@ void GaloisHash::UpdateBlocks(const uint8* bytes, size_t num_blocks) {
void GaloisHash::Update(const uint8* data, size_t length) {
if (buf_used_ > 0) {
- const size_t n = std::min(length, buf_used_);
+ const size_t n = std::min(length, sizeof(buf_) - buf_used_);
memcpy(&buf_[buf_used_], data, n);
buf_used_ += n;
length -= n;
« no previous file with comments | « no previous file | crypto/ghash_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698