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

Side by Side Diff: net/quic/quic_framer.cc

Issue 1558423002: relnote: Change memcpy to memmove in QuicFramer::EncryptPayload, because the src and dest buffers m… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@29_CL_111321766
Patch Set: Created 4 years, 11 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/quic/quic_framer.h" 5 #include "net/quic/quic_framer.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 1673 matching lines...) Expand 10 before | Expand all | Expand 10 after
1684 QuicPacketNumber packet_number, 1684 QuicPacketNumber packet_number,
1685 const QuicPacket& packet, 1685 const QuicPacket& packet,
1686 char* buffer, 1686 char* buffer,
1687 size_t buffer_len) { 1687 size_t buffer_len) {
1688 DCHECK(encrypter_[level].get() != nullptr); 1688 DCHECK(encrypter_[level].get() != nullptr);
1689 1689
1690 StringPiece associated_data = packet.AssociatedData(); 1690 StringPiece associated_data = packet.AssociatedData();
1691 // Copy in the header, because the encrypter only populates the encrypted 1691 // Copy in the header, because the encrypter only populates the encrypted
1692 // plaintext content. 1692 // plaintext content.
1693 const size_t ad_len = associated_data.length(); 1693 const size_t ad_len = associated_data.length();
1694 memcpy(buffer, associated_data.data(), ad_len); 1694 memmove(buffer, associated_data.data(), ad_len);
1695 // Encrypt the plaintext into the buffer. 1695 // Encrypt the plaintext into the buffer.
1696 size_t output_length = 0; 1696 size_t output_length = 0;
1697 if (!encrypter_[level]->EncryptPacket(packet_number, associated_data, 1697 if (!encrypter_[level]->EncryptPacket(packet_number, associated_data,
1698 packet.Plaintext(), buffer + ad_len, 1698 packet.Plaintext(), buffer + ad_len,
1699 &output_length, buffer_len - ad_len)) { 1699 &output_length, buffer_len - ad_len)) {
1700 RaiseError(QUIC_ENCRYPTION_FAILURE); 1700 RaiseError(QUIC_ENCRYPTION_FAILURE);
1701 return 0; 1701 return 0;
1702 } 1702 }
1703 1703
1704 return ad_len + output_length; 1704 return ad_len + output_length;
(...skipping 555 matching lines...) Expand 10 before | Expand all | Expand 10 after
2260 2260
2261 bool QuicFramer::RaiseError(QuicErrorCode error) { 2261 bool QuicFramer::RaiseError(QuicErrorCode error) {
2262 DVLOG(1) << "Error: " << QuicUtils::ErrorToString(error) 2262 DVLOG(1) << "Error: " << QuicUtils::ErrorToString(error)
2263 << " detail: " << detailed_error_; 2263 << " detail: " << detailed_error_;
2264 set_error(error); 2264 set_error(error);
2265 visitor_->OnError(this); 2265 visitor_->OnError(this);
2266 return false; 2266 return false;
2267 } 2267 }
2268 2268
2269 } // namespace net 2269 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698