Bug 1491755 - Fix 'truncated password' when using AUTH PLAIN (SMTP). r=jorgk
authorAlfred Peters <infofrommozilla@gmail.com>
Sun, 23 Sep 2018 08:01:00 +0200
changeset 33214 afd14a54871a034558d33deb86ea36e4120ff6b2
parent 33213 781c9a24b9533f8fb8bedb5e65c7ffb80a983e9d
child 33215 e55253fbb27b710e80d766e4d0cec7c43ffaac0b
push id387
push userclokep@gmail.com
push dateMon, 10 Dec 2018 21:30:47 +0000
reviewersjorgk
bugs1491755
Bug 1491755 - Fix 'truncated password' when using AUTH PLAIN (SMTP). r=jorgk
mailnews/compose/src/nsSmtpProtocol.cpp
--- a/mailnews/compose/src/nsSmtpProtocol.cpp
+++ b/mailnews/compose/src/nsSmtpProtocol.cpp
@@ -1519,17 +1519,17 @@ nsresult nsSmtpProtocol::AuthLoginStep1(
       passwordUTF8.Truncate(255);
 
     // RFC 4616: UTF8NUL authcid UTF8NUL passwd
     char plain_string[513];
     memset(plain_string, 0, 513);
     PR_snprintf(&plain_string[1], 256, "%s", username.get());
     int len = username.Length() + 2;  // We include two <NUL> characters.
     PR_snprintf(&plain_string[len], 256, "%s", passwordUTF8.get());
-    len += password.Length();
+    len += passwordUTF8.Length();
 
     base64Str = PL_Base64Encode(plain_string, len, nullptr);
     PR_snprintf(buffer, sizeof(buffer), "AUTH PLAIN %s" CRLF, base64Str);
   }
   else if (m_currentAuthMethod == SMTP_AUTH_LOGIN_ENABLED)
   {
     MOZ_LOG(SMTPLogModule, mozilla::LogLevel::Debug, ("LOGIN auth"));
     if (username.Length() > 255)