Bug 1060419 - make security/certverifier/ExtendedValidation.cpp use Sprintf.h, r?froydnj draft
authorTom Tromey <tom@tromey.com>
Sat, 17 Dec 2016 13:47:13 -0700
changeset 467288 5f255025ff916d9a23622383f71efef11187f742
parent 467287 02bb6533da4ac9fd8e474b597444f727539bf91d
child 467289 5b43e30402ee14bd189ae1d945e57a0caa27e39f
push id43131
push userbmo:ttromey@mozilla.com
push dateFri, 27 Jan 2017 13:26:13 +0000
reviewersfroydnj
bugs1060419
milestone53.0a1
Bug 1060419 - make security/certverifier/ExtendedValidation.cpp use Sprintf.h, r?froydnj MozReview-Commit-ID: J7oqo88iPKQ
security/certverifier/ExtendedValidation.cpp
--- a/security/certverifier/ExtendedValidation.cpp
+++ b/security/certverifier/ExtendedValidation.cpp
@@ -10,17 +10,17 @@
 #include "cert.h"
 #include "certdb.h"
 #include "hasht.h"
 #include "mozilla/ArrayUtils.h"
 #include "mozilla/Assertions.h"
 #include "mozilla/Casting.h"
 #include "mozilla/PodOperations.h"
 #ifdef ANDROID
-#include "nsPrintfCString.h"
+#include "mozilla/Sprintf.h"
 #endif
 #include "pk11pub.h"
 #include "pkix/pkixtypes.h"
 #include "prerror.h"
 #include "prinit.h"
 #include "secerr.h"
 
 extern mozilla::LazyLogModule gPIPNSSLog;
@@ -1251,24 +1251,24 @@ CertIsAuthoritativeForEVPolicy(const Uni
   }
 
   return false;
 }
 
 #ifdef ANDROID
 static char sCrashReasonBuffer[1024];
 
-static void
-CrashWithReason(const char* messageFormat, const char* string,
-                PRErrorCode errorCode)
+static MOZ_FORMAT_PRINTF(1, 2) void
+CrashWithReason(const char* messageFormat, ...)
 {
-  nsPrintfCString assertionMessage(messageFormat, string, errorCode);
+  va_list ap;
+  va_start(ap, messageFormat);
   mozilla::PodArrayZero(sCrashReasonBuffer);
-  strncpy(sCrashReasonBuffer, assertionMessage.get(),
-          sizeof(sCrashReasonBuffer));
+  VsprintfLiteral(sCrashReasonBuffer, messageFormat, ap);
+  va_end(ap);
   MOZ_CRASH_ANNOTATE(sCrashReasonBuffer);
   MOZ_REALLY_CRASH();
 }
 #endif
 
 nsresult
 LoadExtendedValidationInfo()
 {