Bug 1577706 - C-C part: Check osint parameters 'compose' and 'mail'. r=me
authorJorg K <jorgk@jorgk.com>
Wed, 04 Sep 2019 08:50:02 +0200
changeset 36729 4465703476238ffb94fc1cf8b008204d541d958f
parent 36728 dc8ba56d0d5492d09dddb7aac3d71fafe2610cd1
child 36730 109de898dc041df77c85d741d8e4e85b56014270
push id395
push userclokep@gmail.com
push dateMon, 02 Dec 2019 19:38:57 +0000
reviewersme
bugs1577706
Bug 1577706 - C-C part: Check osint parameters 'compose' and 'mail'. r=me
mail/app/nsMailApp.cpp
--- a/mail/app/nsMailApp.cpp
+++ b/mail/app/nsMailApp.cpp
@@ -1,14 +1,15 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "nsXULAppAPI.h"
+#include "mozilla/CmdLineAndEnvUtils.h"
 #include "mozilla/XREAppData.h"
 #include "application.ini.h"
 #include "mozilla/Bootstrap.h"
 #if defined(XP_WIN)
 #  include <windows.h>
 #  include <stdlib.h>
 #elif defined(XP_UNIX)
 #  include <sys/resource.h>
@@ -202,16 +203,21 @@ static int do_main(int argc, char* argv[
   config.sandboxPermissionsService = permissionsService;
 #endif
 
 #ifdef LIBFUZZER
   if (getenv("LIBFUZZER"))
     gBootstrap->XRE_LibFuzzerSetDriver(fuzzer::FuzzerDriver);
 #endif
 
+  // Note: FF needs to keep in sync with LauncherProcessWin,
+  //       TB doesn't have that file.
+  const char* acceptableParams[] = {"compose", "mail", nullptr};
+  EnsureCommandlineSafe(argc, argv, acceptableParams);
+
   return gBootstrap->XRE_main(argc, argv, config);
 }
 
 static nsresult InitXPCOMGlue() {
   UniqueFreePtr<char> exePath = BinaryPath::Get();
   if (!exePath) {
     Output("Couldn't find the application directory.\n");
     return NS_ERROR_FAILURE;