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

Unified Diff: net/quic/quic_packet_creator.cc

Issue 2007223002: Explicitly disallow multi-packet CHLOs. Protected by FLAGS_quic_disallow_multi_packet_chlo, default… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@122481524
Patch Set: remove static_cast Created 4 years, 7 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 | « net/quic/quic_flags.cc ('k') | net/quic/quic_packet_creator_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/quic/quic_packet_creator.cc
diff --git a/net/quic/quic_packet_creator.cc b/net/quic/quic_packet_creator.cc
index 686fed285aa346abec8bdbf36b73736f98e9583f..f0970cc2a094cfc747b8941af4c1682c25e68c81 100644
--- a/net/quic/quic_packet_creator.cc
+++ b/net/quic/quic_packet_creator.cc
@@ -8,6 +8,7 @@
#include "base/logging.h"
#include "base/macros.h"
+#include "net/quic/crypto/crypto_protocol.h"
#include "net/quic/crypto/quic_random.h"
#include "net/quic/quic_bug_tracker.h"
#include "net/quic/quic_data_writer.h"
@@ -165,6 +166,21 @@ bool QuicPacketCreator::ConsumeData(QuicStreamId id,
return false;
}
CreateStreamFrame(id, iov, iov_offset, offset, fin, frame);
+ // Explicitly disallow multi-packet CHLOs.
+ if (FLAGS_quic_disallow_multi_packet_chlo && id == kCryptoStreamId &&
+ frame->stream_frame->data_length >= sizeof(kCHLO) &&
+ strncmp(frame->stream_frame->data_buffer,
+ reinterpret_cast<const char*>(&kCHLO), sizeof(kCHLO)) == 0) {
+ DCHECK_EQ(0u, iov_offset);
+ if (frame->stream_frame->data_length < iov.iov->iov_len) {
+ const string error_details = "Client hello won't fit in a single packet.";
+ QUIC_BUG << error_details;
+ delegate_->OnUnrecoverableError(QUIC_CRYPTO_CHLO_TOO_LARGE, error_details,
+ ConnectionCloseSource::FROM_SELF);
+ delete frame->stream_frame;
+ return false;
+ }
+ }
if (!AddFrame(*frame, /*save_retransmittable_frames=*/true)) {
// Fails if we try to write unencrypted stream data.
delete frame->stream_frame;
« no previous file with comments | « net/quic/quic_flags.cc ('k') | net/quic/quic_packet_creator_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698