Chromium Code Reviews| Index: net/quic/core/crypto/crypto_handshake_message.cc |
| diff --git a/net/quic/core/crypto/crypto_handshake_message.cc b/net/quic/core/crypto/crypto_handshake_message.cc |
| index 220c46adfc0d3e2e9551e88adab078dd1afac6d7..0d0813abb843e9570f0ac517458689809a476c47 100644 |
| --- a/net/quic/core/crypto/crypto_handshake_message.cc |
| +++ b/net/quic/core/crypto/crypto_handshake_message.cc |
| @@ -79,9 +79,9 @@ void CryptoHandshakeMessage::Erase(QuicTag tag) { |
| tag_value_map_.erase(tag); |
| } |
| -QuicErrorCode CryptoHandshakeMessage::GetTaglist(QuicTag tag, |
| - const QuicTag** out_tags, |
| - size_t* out_len) const { |
| +QuicErrorCode CryptoHandshakeMessage::GetTaglist( |
| + QuicTag tag, |
| + QuicTagVector* out_tags) const { |
| QuicTagValueMap::const_iterator it = tag_value_map_.find(tag); |
| QuicErrorCode ret = QUIC_NO_ERROR; |
| @@ -92,13 +92,17 @@ QuicErrorCode CryptoHandshakeMessage::GetTaglist(QuicTag tag, |
| } |
| if (ret != QUIC_NO_ERROR) { |
| - *out_tags = nullptr; |
| - *out_len = 0; |
| + out_tags->clear(); |
| return ret; |
| } |
| - *out_tags = reinterpret_cast<const QuicTag*>(it->second.data()); |
| - *out_len = it->second.size() / sizeof(QuicTag); |
| + size_t num_tags = it->second.size() / sizeof(QuicTag); |
| + out_tags->resize(num_tags); |
| + for (size_t i = 0; i < num_tags; ++i) { |
| + QuicTag tag; |
| + memcpy(&tag, it->second.data() + i * sizeof(tag), sizeof(tag)); |
|
Nico
2017/06/12 20:32:31
A few short weeks later, I suddenly remembered thi
Ryan Hamilton
2017/06/12 20:48:41
Ooo! That's good to know. We can depend on base (t
|
| + (*out_tags)[i] = tag; |
| + } |
| return ret; |
| } |