QDBusUtil::isValidBusName: implement "contains at least two such elements"
It was in our docs but we didn't implement it. This failure allowed QDBusMessagePrivate::toDBusMessage() to proceed in calling libdbus-1 methods, which had the validation and might crash the application. Pick-to: 6.5 6.2 Fixes: QTBUG-130304 Change-Id: Ibb5d210c03672a363016fffd7b1a2b55c02119bd Reviewed-by: Ahmad Samir <a.samirh78@gmail.com> (cherry picked from commit f42f5b56140342238c325a014fbe8e179eff4348) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
db412baf62
commit
7955c58bca
@ -407,6 +407,8 @@ namespace QDBusUtil
|
||||
return isValidUniqueConnectionName(busName);
|
||||
|
||||
const auto parts = QStringView{busName}.split(u'.');
|
||||
if (parts.size() < 2)
|
||||
return false;
|
||||
for (QStringView part : parts) {
|
||||
if (part.isEmpty())
|
||||
return false;
|
||||
|
@ -938,6 +938,10 @@ void tst_QDBusMarshall::sendCallErrors_data()
|
||||
<< "org.freedesktop.DBus.Error.UnknownMethod"
|
||||
<< "Method \"ping\" with signature \"\" on interface \"org.qtproject.autotests.qpong\" doesn't exist\n" << (const char*)0;
|
||||
|
||||
QTest::newRow("invalid-service-single-label") << "service" << objectPath << interfaceName << "ping" << QVariantList()
|
||||
<< "org.qtproject.QtDBus.Error.InvalidService"
|
||||
<< "Invalid service name: service" << "";
|
||||
|
||||
QTest::newRow("invalid-service") << "this isn't valid" << objectPath << interfaceName << "ping" << QVariantList()
|
||||
<< "org.qtproject.QtDBus.Error.InvalidService"
|
||||
<< "Invalid service name: this isn't valid" << "";
|
||||
|
Loading…
x
Reference in New Issue
Block a user