Bug 1509504: Trunacte outStr within nsCSPContext::GetPolicyString. r=baku
authorChristoph Kerschbaumer <ckerschb@christophkerschbaumer.com>
Fri, 23 Nov 2018 16:05:24 +0100
changeset 504442 9d911745f1d14397a313ff695cec0901316db1d7
parent 504441 6e8d63408d5f47a78606e2fd02bb9ce049da4556
child 504443 102c7135d95248e596d0c3efcdaa4a634367f77d
push id10290
push userffxbld-merge
push dateMon, 03 Dec 2018 16:23:23 +0000
treeherdermozilla-beta@700bed2445e6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbaku
bugs1509504
milestone65.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1509504: Trunacte outStr within nsCSPContext::GetPolicyString. r=baku
dom/security/nsCSPContext.cpp
--- a/dom/security/nsCSPContext.cpp
+++ b/dom/security/nsCSPContext.cpp
@@ -284,16 +284,17 @@ nsCSPContext::~nsCSPContext()
   for (uint32_t i = 0; i < mPolicies.Length(); i++) {
     delete mPolicies[i];
   }
 }
 
 NS_IMETHODIMP
 nsCSPContext::GetPolicyString(uint32_t aIndex, nsAString& outStr)
 {
+  outStr.Truncate();
   if (aIndex >= mPolicies.Length()) {
     return NS_ERROR_ILLEGAL_VALUE;
   }
   mPolicies[aIndex]->toString(outStr);
   return NS_OK;
 }
 
 const nsCSPPolicy*