mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-01 17:23:59 +00:00
extend cram md5 digest result len buffer to 17 bytes r/sr=sspitzer 41594
This commit is contained in:
parent
a4cf9a723d
commit
d11405d58c
@ -733,10 +733,9 @@ GetOrCreateFolder(const nsACString &aURI, nsIUrlListener *aListener)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// digest needs to be a pointer to a 16 byte buffer
|
||||
// digest needs to be a pointer to a DIGEST_LENGTH (17) byte buffer
|
||||
nsresult MSGCramMD5(const char *text, PRInt32 text_len, const char *key, PRInt32 key_len, unsigned char *digest)
|
||||
{
|
||||
#define DIGEST_LENGTH 16
|
||||
nsresult rv;
|
||||
unsigned char result[DIGEST_LENGTH];
|
||||
unsigned char *presult = result;
|
||||
@ -808,6 +807,7 @@ nsresult MSGCramMD5(const char *text, PRInt32 text_len, const char *key, PRInt32
|
||||
rv = verifier->HashUpdate(context, (const char *) result, 16); /* then results of 1st hash */
|
||||
rv = verifier->HashEnd(context, &presult, &resultLen, DIGEST_LENGTH); /* finish up 2nd pass */
|
||||
strncpy((char *) digest, (const char *) result, DIGEST_LENGTH);
|
||||
digest[DIGEST_LENGTH] = '\0';
|
||||
return rv;
|
||||
|
||||
}
|
||||
|
@ -93,7 +93,9 @@ NS_MSG_BASE nsresult IsRFC822HeaderFieldName(const char *aHdr, PRBool *aResult);
|
||||
*/
|
||||
NS_MSG_BASE nsresult GetOrCreateFolder(const nsACString & aURI, nsIUrlListener *aListener);
|
||||
|
||||
// digest needs to be a pointer to a 16 byte buffer
|
||||
// digest needs to be a pointer to a 17 byte buffer
|
||||
#define DIGEST_LENGTH 17
|
||||
|
||||
NS_MSG_BASE nsresult MSGCramMD5(const char *text, PRInt32 text_len, const char *key, PRInt32 key_len, unsigned char *digest);
|
||||
#endif
|
||||
|
||||
|
@ -957,7 +957,7 @@ PRInt32 nsSmtpProtocol::AuthLoginPassword()
|
||||
char buffer[512];
|
||||
if (TestFlag(SMTP_AUTH_CRAM_MD5_ENABLED))
|
||||
{
|
||||
unsigned char digest[16];
|
||||
unsigned char digest[DIGEST_LENGTH];
|
||||
char * decodedChallenge = PL_Base64Decode(m_responseText.get(),
|
||||
m_responseText.Length() - 2 /* subtract CRLF */, nsnull);
|
||||
|
||||
|
@ -3847,7 +3847,7 @@ nsImapIncomingServer::GetMsgFolderFromURI(nsIMsgFolder *aFolderResource, const c
|
||||
NS_IMETHODIMP
|
||||
nsImapIncomingServer::CramMD5Hash(const char *decodedChallenge, const char *key, char **result)
|
||||
{
|
||||
unsigned char resultDigest[16];
|
||||
unsigned char resultDigest[DIGEST_LENGTH];
|
||||
nsresult rv = MSGCramMD5(decodedChallenge, strlen(decodedChallenge),
|
||||
key, strlen(key), resultDigest);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
Loading…
Reference in New Issue
Block a user