Bug 1363011 - [Static Analysis] Buffer not null terminated in int NS_main(int argc, NS_tchar **argv). r?andi
MozReview-Commit-ID: Depkt6zvxQ1
--- 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