Author: arina
Date: 2007-10-31 03:21:13 -0500 (Wed, 31 Oct 2007)
New Revision: 88539

Modified:
   trunk/mcs/class/System/System.Net.Mail/ChangeLog
   trunk/mcs/class/System/System.Net.Mail/SmtpClient.cs
Log:
Fix of SmtpClient.Read() method:
        Added check of string position before calling 
        Substring and IndexOf methods of string.

Modified: trunk/mcs/class/System/System.Net.Mail/ChangeLog
===================================================================
--- trunk/mcs/class/System/System.Net.Mail/ChangeLog    2007-10-31 07:57:03 UTC 
(rev 88538)
+++ trunk/mcs/class/System/System.Net.Mail/ChangeLog    2007-10-31 08:21:13 UTC 
(rev 88539)
@@ -1,3 +1,9 @@
+2007-10-30 Arina Itkes <[EMAIL PROTECTED]>
+
+       * SmtpClient.cs: Fix of SmtpClient.Read() method:
+       Added check of string position before calling 
+       Substring and IndexOf methods of string.
+
 2007-10-23  Atsushi Enomoto  <[EMAIL PROTECTED]>
 
        * SmtpClient.cs : small async refactory.

Modified: trunk/mcs/class/System/System.Net.Mail/SmtpClient.cs
===================================================================
--- trunk/mcs/class/System/System.Net.Mail/SmtpClient.cs        2007-10-31 
07:57:03 UTC (rev 88538)
+++ trunk/mcs/class/System/System.Net.Mail/SmtpClient.cs        2007-10-31 
08:21:13 UTC (rev 88539)
@@ -370,7 +370,7 @@
                                if (ln != 0)
                                        ln++;
                                
-                               if (ln > extens.Length)
+                               if (ln + 4 >= extens.Length)
                                        break;
                                
                                if (extens.Substring (ln, 4) == "AUTH" &&
@@ -403,10 +403,10 @@
                                                        break;
                                                }
                                        }
-                               } else if (extens.Substring (ln, 8) == 
"STARTTLS") {
+                               } else if (ln + 8 < extens.Length && 
extens.Substring (ln, 8) == "STARTTLS") {
                                        canStartTLS = true;
                                }
-                       } while ((ln = extens.IndexOf ('\n', ln)) != -1);
+                       } while (ln < extens.Length && ((ln = extens.IndexOf 
('\n', ln)) != -1));
                }
 
                public void Send (MailMessage message)

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to