Prevent memory corruption by StreamId::Set

Use RTC_CHECK to crash if attempting to set an RSID whose name's length exceeds the maximum.

BUG=None

Review-Url: https://codereview.webrtc.org/2915913003
Cr-Commit-Position: refs/heads/master@{#18405}
This commit is contained in:
eladalon 2017-06-02 03:37:48 -07:00 committed by Commit Bot
parent 5522021b45
commit 4a3c9f60a3

View File

@ -25,7 +25,7 @@ constexpr size_t StreamId::kMaxSize;
void StreamId::Set(const char* data, size_t size) {
// If |data| contains \0, the stream id size might become less than |size|.
RTC_DCHECK_LE(size, kMaxSize);
RTC_CHECK_LE(size, kMaxSize);
memcpy(value_, data, size);
if (size < kMaxSize)
value_[size] = 0;