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:
parent
5522021b45
commit
4a3c9f60a3
@ -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;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user