提交 54b1b23f authored 作者: Iñaki Baz Castillo's avatar Iñaki Baz Castillo

StunMessage::Parse(): make sure that, if present, MESSAGE-INTEGRITY value is 20 bytes (fixes #254)

上级 23140728
......@@ -211,6 +211,15 @@ namespace RTC
case Attribute::MESSAGE_INTEGRITY:
{
// Ensure attribute length is 20 bytes.
if (attrLength != 20)
{
MS_WARN_TAG(ice, "attribute MESSAGE-INTEGRITY must be 20 bytes length, message discarded");
delete msg;
return nullptr;
}
hasMessageIntegrity = true;
msg->SetMessageIntegrity(attrValuePos);
......@@ -387,7 +396,7 @@ namespace RTC
MS_DEBUG_DEV(" messageIntegrity: %s", messageIntegrity);
}
if (this->hasFingerprint)
MS_DEBUG_DEV(" fingerprint");
MS_DEBUG_DEV(" has fingerprint");
MS_DEBUG_DEV("</StunMessage>");
}
......@@ -403,7 +412,7 @@ namespace RTC
case Class::INDICATION:
{
// Both USERNAME and MESSAGE-INTEGRITY must be present.
if ((this->messageIntegrity == nullptr) || this->username.empty())
if (this->messageIntegrity == nullptr || this->username.empty())
return Authentication::BAD_REQUEST;
// Check that USERNAME attribute begins with our local username plus ":".
......
Markdown 格式
0% 或
您添加了 0 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论