Bug 720016 - warning when compiling the maintenance service - swprintf takes a count parameter. r=bbondy
authorRobert Strong <robert.bugzilla@gmail.com>
Sun, 22 Jan 2012 15:55:22 -0800
changeset 86316 946022ef981f3c5dcd358a3c2e3df75d29aa6ccb
parent 86273 d43360499b86d66d82ed0e585b75bb3237864ad2
child 86317 42368fe44c8ca09c48b12cea0a611e3493cd6769
push id805
push userakeybl@mozilla.com
push dateWed, 01 Feb 2012 18:17:35 +0000
treeherdermozilla-aurora@6fb3bf232436 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbbondy
bugs720016
milestone12.0a1
Bug 720016 - warning when compiling the maintenance service - swprintf takes a count parameter. r=bbondy
toolkit/components/maintenanceservice/maintenanceservice.cpp
--- a/toolkit/components/maintenanceservice/maintenanceservice.cpp
+++ b/toolkit/components/maintenanceservice/maintenanceservice.cpp
@@ -181,19 +181,21 @@ GetLogDirectoryPath(WCHAR *path)
  * @return TRUE if successful.
  */
 BOOL
 GetBackupLogPath(LPWSTR path, LPCWSTR basePath, int logNumber)
 {
   WCHAR logName[64];
   wcscpy(path, basePath);
   if (logNumber <= 0) {
-    swprintf(logName, L"maintenanceservice.log");
+    swprintf(logName, sizeof(logName) / sizeof(logName[0]),
+             L"maintenanceservice.log");
   } else {
-    swprintf(logName, L"maintenanceservice-%d.log", logNumber);
+    swprintf(logName, sizeof(logName) / sizeof(logName[0]),
+             L"maintenanceservice-%d.log", logNumber);
   }
   return PathAppendSafe(path, logName);
 }
 
 /**
  * Moves the old log files out of the way before a new one is written.
  * If you for example keep 3 logs, then this function will do:
  *   updater2.log -> updater3.log