Bug 1418770 - Truncate DBus names used for remote service to DBUS_MAXIMUM_NAME_LENGTH, r=jhorak

MozReview-Commit-ID: 3Hrt3Ef87WD

--HG--
extra : rebase_source : 9ece42adec435b244f5875f7e3449f6268c0beea
This commit is contained in:
Martin Stransky 2018-02-13 13:59:39 +01:00
parent 72413786ab
commit 9c4741153c
2 changed files with 6 additions and 0 deletions

View File

@ -186,6 +186,9 @@ nsDBusRemoteService::Startup(const char* aAppName, const char* aProfileName)
nsAutoCString busName;
busName = nsPrintfCString("org.mozilla.%s.%s", mAppName.get(),
profileName.get());
if (busName.Length() > DBUS_MAXIMUM_NAME_LENGTH)
busName.Truncate(DBUS_MAXIMUM_NAME_LENGTH);
DBusError err;
dbus_error_init(&err);
dbus_bus_request_name(mConnection, busName.get(),

View File

@ -133,6 +133,9 @@ DBusRemoteClient::GetRemoteDestinationName(const char *aProgram,
aDestinationName = nsPrintfCString("org.mozilla.%s.%s", aProgram,
profileName.get());
if (aDestinationName.Length() > DBUS_MAXIMUM_NAME_LENGTH)
aDestinationName.Truncate(DBUS_MAXIMUM_NAME_LENGTH);
return true;
}
}