Add connection ID length checks
These changes only impact behavior for versions that support variable length connection IDs, and all of those versions are disabled by flags, so we don't need extra flag protection.
gfe-relnote: add connection ID length checks, protected by disabled quic_enable_v47 flag
PiperOrigin-RevId: 261237221
Change-Id: I89e7bec58644b7ec18e3c7ce3ecbd6d93c9c0fc3
diff --git a/quic/core/quic_data_reader.cc b/quic/core/quic_data_reader.cc
index e2871d7..71395dd 100644
--- a/quic/core/quic_data_reader.cc
+++ b/quic/core/quic_data_reader.cc
@@ -160,7 +160,8 @@
}
connection_id->set_length(length);
- const bool ok = ReadBytes(connection_id->mutable_data(), length);
+ const bool ok =
+ ReadBytes(connection_id->mutable_data(), connection_id->length());
DCHECK(ok);
return ok;
}