Relax check for unknown STUN attribute lengths
Bug: chromium:1155459 Change-Id: I51cb8162a989ba934e3292c86c3ecf749f26f601 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/196500 Commit-Queue: Jonas Oreland <jonaso@google.com> Commit-Queue: Harald Alvestrand <hta@webrtc.org> Reviewed-by: Jonas Oreland <jonaso@webrtc.org> Cr-Commit-Position: refs/heads/master@{#32773}
This commit is contained in:

committed by
Commit Bot

parent
85e62e6d13
commit
837f13c84c
@ -33,6 +33,7 @@ namespace {
|
|||||||
const int k127Utf8CharactersLengthInBytes = 508;
|
const int k127Utf8CharactersLengthInBytes = 508;
|
||||||
const int kDefaultMaxAttributeLength = 508;
|
const int kDefaultMaxAttributeLength = 508;
|
||||||
const int kMessageIntegrityAttributeLength = 20;
|
const int kMessageIntegrityAttributeLength = 20;
|
||||||
|
const int kTheoreticalMaximumAttributeLength = 65535;
|
||||||
|
|
||||||
uint32_t ReduceTransactionId(const std::string& transaction_id) {
|
uint32_t ReduceTransactionId(const std::string& transaction_id) {
|
||||||
RTC_DCHECK(transaction_id.length() == cricket::kStunTransactionIdLength ||
|
RTC_DCHECK(transaction_id.length() == cricket::kStunTransactionIdLength ||
|
||||||
@ -77,10 +78,10 @@ bool LengthValid(int type, int length) {
|
|||||||
// No length restriction in RFC; it's the content of an UDP datagram,
|
// No length restriction in RFC; it's the content of an UDP datagram,
|
||||||
// which in theory can be up to 65.535 bytes.
|
// which in theory can be up to 65.535 bytes.
|
||||||
// TODO(bugs.webrtc.org/12179): Write a test to find the real limit.
|
// TODO(bugs.webrtc.org/12179): Write a test to find the real limit.
|
||||||
return length <= 65535;
|
return length <= kTheoreticalMaximumAttributeLength;
|
||||||
default:
|
default:
|
||||||
// Return an arbitrary restriction for all other types.
|
// Return an arbitrary restriction for all other types.
|
||||||
return length <= kDefaultMaxAttributeLength;
|
return length <= kTheoreticalMaximumAttributeLength;
|
||||||
}
|
}
|
||||||
RTC_NOTREACHED();
|
RTC_NOTREACHED();
|
||||||
return true;
|
return true;
|
||||||
|
Reference in New Issue
Block a user