Bug 1363011 - [Static Analysis] Buffer not null terminated in int NS_main(int argc, NS_tchar **argv). r?andi draft
authortiago <tiago.paez11@gmail.com>
Sun, 14 May 2017 21:43:48 -0300
changeset 577578 20f7bd1d9570a18be1fa8de3314ce8b6f3323d2a
parent 577554 e66dedabe582ba7b394aee4f89ed70fe389b3c46
child 628529 203c2c812582e129ead1a03008c8e87e5cbfba19
push id58720
push userbmo:tiago.paez11@gmail.com
push dateMon, 15 May 2017 00:44:05 +0000
reviewersandi
bugs1363011
milestone55.0a1
Bug 1363011 - [Static Analysis] Buffer not null terminated in int NS_main(int argc, NS_tchar **argv). r?andi MozReview-Commit-ID: Depkt6zvxQ1
toolkit/mozapps/update/updater/updater.cpp
--- a/toolkit/mozapps/update/updater/updater.cpp
+++ b/toolkit/mozapps/update/updater/updater.cpp
@@ -2751,16 +2751,17 @@ int NS_main(int argc, NS_tchar **argv)
       freeArguments(argc, argv);
       CleanupElevatedMacUpdate(true);
     }
 #endif
     return 1;
   }
   // The directory containing the update information.
   NS_tstrncpy(gPatchDirPath, argv[1], MAXPATHLEN);
+  gPatchDirPath[MAXPATHLEN - 1] = NS_T('\0');
 
   // This check is also performed in workmonitor.cpp since the maintenance
   // service can be called directly.
   if (!IsValidFullPath(argv[2])) {
     WriteStatusFile(INVALID_INSTALL_DIR_PATH_ERROR);
     fprintf(stderr, "The install directory path is not valid for this "  \
             "application (" LOG_S ")\n", argv[2]);
 #ifdef XP_MACOSX