Bug 926042 - Convert path length to unsigned ints to avoid overflowing and crashing. r=jduell
authorDaniel Stenberg <daniel@haxx.se>
Thu, 23 Jan 2014 09:38:29 -0500
changeset 180863 fc5112c72bba376ecc93191d196abbf4f0f7343b
parent 180862 9b4dfa6818b940c5793a44046c7aad06f89d8497
child 180864 532334f941089fc22241ed1ba5e18979d0c72d52
push id3343
push userffxbld
push dateMon, 17 Mar 2014 21:55:32 +0000
treeherdermozilla-beta@2f7d3415f79f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjduell
bugs926042
milestone29.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 926042 - Convert path length to unsigned ints to avoid overflowing and crashing. r=jduell
netwerk/protocol/http/nsHttpDigestAuth.cpp
--- a/netwerk/protocol/http/nsHttpDigestAuth.cpp
+++ b/netwerk/protocol/http/nsHttpDigestAuth.cpp
@@ -499,19 +499,19 @@ nsHttpDigestAuth::CalculateHA1(const nsA
 
 nsresult
 nsHttpDigestAuth::CalculateHA2(const nsAFlatCString & method,
                                const nsAFlatCString & path,
                                uint16_t qop,
                                const char * bodyDigest,
                                char * result)
 {
-  int16_t methodLen = method.Length();
-  int16_t pathLen = path.Length();
-  int16_t len = methodLen + pathLen + 1;
+  uint16_t methodLen = method.Length();
+  uint32_t pathLen = path.Length();
+  uint32_t len = methodLen + pathLen + 1;
 
   if (qop & QOP_AUTH_INT) {
     len += EXPANDED_DIGEST_LENGTH + 1;
   }
 
   nsAutoCString contents;
   contents.SetCapacity(len);