Bug 1370011 - fix crash in ParseMailtoUrl() when calling First() on empty string. r=aceman
authorJorg K <jorgk@jorgk.com>
Sun, 04 Jun 2017 21:00:26 +0200
changeset 21630 b1b6c970edf3410c7589cb01fdcc93c50435cbf2
parent 21629 4fb99e8e947aba3e7815cec74b5e6d1ec5f67006
child 21631 4be91f8e5d42d74cb3b18aa86aa29c19ec9f2eb2
push id13184
push usermozilla@jorgk.com
push dateSun, 04 Jun 2017 19:02:24 +0000
treeherdercomm-central@4be91f8e5d42 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersaceman
bugs1370011
Bug 1370011 - fix crash in ParseMailtoUrl() when calling First() on empty string. r=aceman
mailnews/compose/src/nsSmtpUrl.cpp
--- a/mailnews/compose/src/nsSmtpUrl.cpp
+++ b/mailnews/compose/src/nsSmtpUrl.cpp
@@ -90,16 +90,19 @@ nsresult nsMailtoUrl::ParseMailtoUrl(cha
       {
         value = eq+1;
         *eq = 0;
       }
 
       nsCString decodedName;
       MsgUnescapeString(nsDependentCString(token), 0, decodedName);
 
+      if (decodedName.Length() == 0)
+        break;
+
       switch (NS_ToUpper(decodedName.First()))
       {
         /* DO NOT support attachment= in mailto urls. This poses a security fire hole!!!
                           case 'A':
                           if (!PL_strcasecmp (token, "attachment"))
                           m_attachmentPart = value;
                           break;
                      */