Bug 1344081 - Switch to Base64Decode in nsHttpNegotiateAuth::GenerateCredentials. r=jduell

MozReview-Commit-ID: 4A5tEV5Fb8
This commit is contained in:
Eric Rahm 2017-03-13 19:09:26 -07:00
parent 875087211f
commit fab046bdc7

View File

@ -32,6 +32,7 @@
#include "nsNetCID.h"
#include "plbase64.h"
#include "plstr.h"
#include "mozilla/Base64.h"
#include "mozilla/Logging.h"
#include "mozilla/Tokenizer.h"
#include "mozilla/UniquePtr.h"
@ -49,6 +50,8 @@
#include "nsUnicharUtils.h"
#include "mozilla/net/HttpAuthUtils.h"
using mozilla::Base64Decode;
//-----------------------------------------------------------------------------
static const char kNegotiate[] = "Negotiate";
@ -535,17 +538,14 @@ nsHttpNegotiateAuth::GenerateCredentials(nsIHttpAuthenticableChannel *authChanne
while (challenge[len - 1] == '=')
len--;
inTokenLen = (len * 3)/4;
inToken = malloc(inTokenLen);
if (!inToken)
return (NS_ERROR_OUT_OF_MEMORY);
//
// Decode the response that followed the "Negotiate" token
//
if (PL_Base64Decode(challenge, len, (char *) inToken) == nullptr) {
free(inToken);
return(NS_ERROR_UNEXPECTED);
nsresult rv =
Base64Decode(challenge, len, (char**)&inToken, &inTokenLen);
if (NS_FAILED(rv)) {
return rv;
}
}
else {