diff --git a/toolkit/components/remote/nsDBusRemoteService.cpp b/toolkit/components/remote/nsDBusRemoteService.cpp index 7cd9b53ed446..21336fb1b60e 100644 --- a/toolkit/components/remote/nsDBusRemoteService.cpp +++ b/toolkit/components/remote/nsDBusRemoteService.cpp @@ -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(), diff --git a/widget/xremoteclient/DBusRemoteClient.cpp b/widget/xremoteclient/DBusRemoteClient.cpp index 2ca1cafa9a2a..c85c5b868b6f 100644 --- a/widget/xremoteclient/DBusRemoteClient.cpp +++ b/widget/xremoteclient/DBusRemoteClient.cpp @@ -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; } }