Bug 364334: reject too much junk at the end of a date/time string.
authorwtc%google.com
Wed, 08 Aug 2007 01:56:31 +0000
changeset 3858 36cd8a0c3114dd3830858fb1e8b0aa0dfc9230c2
parent 3857 c66f7fd87e1335a769ccaf95aa46be93ce638f77
child 3859 ca8d87bd06dfe5593d5d8275a27a47f8659a435a
push idunknown
push userunknown
push dateunknown
bugs364334
Bug 364334: reject too much junk at the end of a date/time string. Fixed a typo that makes us fail to parse "AST" as a timezone. The patch is contributed by Mats Palmgren <mats.palmgren@bredband.net>. r=wtc.
pr/src/misc/prtime.c
--- a/pr/src/misc/prtime.c
+++ b/pr/src/misc/prtime.c
@@ -1007,43 +1007,38 @@ PR_ParseTimeStringToExplodedTime(
   int date = -1;
   PRInt32 year = -1;
   int hour = -1;
   int min = -1;
   int sec = -1;
 
   const char *rest = string;
 
-#ifdef DEBUG
   int iterations = 0;
-#endif
 
   PR_ASSERT(string && result);
   if (!string || !result) return PR_FAILURE;
 
   while (*rest)
         {
 
-#ifdef DEBUG
           if (iterations++ > 1000)
                 {
-                  PR_ASSERT(0);
                   return PR_FAILURE;
                 }
-#endif
 
           switch (*rest)
                 {
                 case 'a': case 'A':
                   if (month == TT_UNKNOWN &&
                           (rest[1] == 'p' || rest[1] == 'P') &&
                           (rest[2] == 'r' || rest[2] == 'R'))
                         month = TT_APR;
                   else if (zone == TT_UNKNOWN &&
-                                   (rest[1] == 's' || rest[1] == 's') &&
+                                   (rest[1] == 's' || rest[1] == 'S') &&
                                    (rest[2] == 't' || rest[2] == 'T'))
                         zone = TT_AST;
                   else if (month == TT_UNKNOWN &&
                                    (rest[1] == 'u' || rest[1] == 'U') &&
                                    (rest[2] == 'g' || rest[2] == 'G'))
                         month = TT_AUG;
                   break;
                 case 'b': case 'B':