[mapserver-commits] r7728 - trunk/mapserver

svn at osgeo.org svn at osgeo.org
Mon Jun 23 16:09:08 EDT 2008


Author: Assefa
Date: 2008-06-23 16:09:08 -0400 (Mon, 23 Jun 2008)
New Revision: 7728

Modified:
   trunk/mapserver/HISTORY.TXT
   trunk/mapserver/mapogcsos.c
Log:
Detect invalid time strings passed by the user (#2560)

Modified: trunk/mapserver/HISTORY.TXT
===================================================================
--- trunk/mapserver/HISTORY.TXT	2008-06-23 19:19:09 UTC (rev 7727)
+++ trunk/mapserver/HISTORY.TXT	2008-06-23 20:09:08 UTC (rev 7728)
@@ -12,6 +12,8 @@
 Current Version (SVN trunk):
 ----------------------------
 
+- SOS: detect invalid time strings (#2560)
+
 - SOS: more srsName support (#2558)
 
 - mapserv.c, maptemplate.c: fixed problem with arguments to msGenerateImages(). (#2655)

Modified: trunk/mapserver/mapogcsos.c
===================================================================
--- trunk/mapserver/mapogcsos.c	2008-06-23 19:19:09 UTC (rev 7727)
+++ trunk/mapserver/mapogcsos.c	2008-06-23 20:09:08 UTC (rev 7728)
@@ -1074,6 +1074,7 @@
     char *pszReturn = NULL, *pszBegin = NULL, *pszEnd = NULL;
     CPLXMLNode *psRoot=NULL, *psChild=NULL;
     CPLXMLNode *psTime=NULL, *psBegin=NULL, *psEnd=NULL;
+    struct tm tm_struct;
 
     if (pszGmlTime)
     {
@@ -1093,7 +1094,10 @@
                 {
                     psTime = psChild->psNext;
                     if (psTime && psTime->pszValue && psTime->eType == CXT_Text)
-                      pszReturn = strdup(psTime->pszValue);
+                    {
+                        if (msParseTime(psTime->pszValue, &tm_struct) == MS_TRUE)
+                          pszReturn = strdup(psTime->pszValue);
+                    }
                 }
             }
             else
@@ -1115,9 +1119,13 @@
 
                     if (pszBegin && pszEnd)
                     {
-                        pszReturn = strdup(pszBegin);
-                        pszReturn = msStringConcatenate(pszReturn, "/");
-                        pszReturn = msStringConcatenate(pszReturn, pszEnd);
+                        if (msParseTime(pszBegin, &tm_struct) == MS_TRUE &&
+                            msParseTime(pszEnd, &tm_struct) == MS_TRUE)
+                        {
+                            pszReturn = strdup(pszBegin);
+                            pszReturn = msStringConcatenate(pszReturn, "/");
+                            pszReturn = msStringConcatenate(pszReturn, pszEnd);
+                        }
                     }
                 }
             }



More information about the mapserver-commits mailing list