Bug 1383002 - Fix UAF in nsMIMEHeaderParamImpl::DecodeRFC5987Param. r=mcmanus
authorTristan Bourvon <tbourvon@mozilla.com>
Fri, 21 Jul 2017 15:23:38 +0200
changeset 419130 4a444c40f63b397dbc67e71ab187fd4110841ecc
parent 419129 f5acec377801fd8f1a193f2fba787d439c3b078b
child 419131 96cfe82f2bfee15c2cfbf66585df037720f580a8
push id7566
push usermtabara@mozilla.com
push dateWed, 02 Aug 2017 08:25:16 +0000
treeherdermozilla-beta@86913f512c3c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmcmanus
bugs1383002
milestone56.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 1383002 - Fix UAF in nsMIMEHeaderParamImpl::DecodeRFC5987Param. r=mcmanus MozReview-Commit-ID: 2tk9WwUCpsw
netwerk/mime/nsMIMEHeaderParamImpl.cpp
--- a/netwerk/mime/nsMIMEHeaderParamImpl.cpp
+++ b/netwerk/mime/nsMIMEHeaderParamImpl.cpp
@@ -816,18 +816,18 @@ nsMIMEHeaderParamImpl::DecodeRFC5987Para
                                           nsACString& aLang,
                                           nsAString& aResult)
 {
   nsAutoCString charset;
   nsAutoCString language;
   nsAutoCString value;
 
   uint32_t delimiters = 0;
-  const char *encoded = PromiseFlatCString(aParamVal).get();
-  const char *c = encoded;
+  const nsCString& encoded = PromiseFlatCString(aParamVal);
+  const char *c = encoded.get();
 
   while (*c) {
     char tc = *c++;
 
     if (tc == '\'') {
       // single quote
       delimiters++;
     } else if (((unsigned char)tc) >= 128) {