diff options
author | wolfbeast <mcwerewolf@wolfbeast.com> | 2020-01-09 22:35:03 +0100 |
---|---|---|
committer | wolfbeast <mcwerewolf@wolfbeast.com> | 2020-01-09 22:35:03 +0100 |
commit | d44f572bbfde3e8fcadf0ac6ed52a4b1b52329bc (patch) | |
tree | 6482fdf98233ee81da47e9cf97931335a073bfc4 | |
parent | dfc398b5c05960e5e6f13393c25051872b3fa0a5 (diff) | |
download | uxp-d44f572bbfde3e8fcadf0ac6ed52a4b1b52329bc.tar.gz |
Handle missing base64 challenge in NegotiateAuth and NTLMAuth.
-rw-r--r-- | extensions/auth/nsHttpNegotiateAuth.cpp | 5 | ||||
-rw-r--r-- | netwerk/protocol/http/nsHttpNTLMAuth.cpp | 4 |
2 files changed, 6 insertions, 3 deletions
diff --git a/extensions/auth/nsHttpNegotiateAuth.cpp b/extensions/auth/nsHttpNegotiateAuth.cpp index adea54b850..8b6be915e9 100644 --- a/extensions/auth/nsHttpNegotiateAuth.cpp +++ b/extensions/auth/nsHttpNegotiateAuth.cpp @@ -530,8 +530,11 @@ nsHttpNegotiateAuth::GenerateCredentials(nsIHttpAuthenticableChannel *authChanne challenge++; len = strlen(challenge); + if (!len)
+ return NS_ERROR_UNEXPECTED;
+ // strip off any padding (see bug 230351) - while (challenge[len - 1] == '=') + while (len && challenge[len - 1] == '=') len--; // diff --git a/netwerk/protocol/http/nsHttpNTLMAuth.cpp b/netwerk/protocol/http/nsHttpNTLMAuth.cpp index aa5b1f8f7e..86bfcf4d13 100644 --- a/netwerk/protocol/http/nsHttpNTLMAuth.cpp +++ b/netwerk/protocol/http/nsHttpNTLMAuth.cpp @@ -486,8 +486,8 @@ nsHttpNTLMAuth::GenerateCredentials(nsIHttpAuthenticableChannel *authChannel, len -= 5; // strip off any padding (see bug 230351) - while (challenge[len - 1] == '=') - len--; + while (len && challenge[len - 1] == '=') + len--; // decode into the input secbuffer rv = Base64Decode(challenge, len, (char**)&inBuf, &inBufLen); |