[mapserver-commits] r9763 - trunk/mapserver

svn at osgeo.org svn at osgeo.org
Wed Jan 27 13:21:59 EST 2010


Author: assefa
Date: 2010-01-27 13:21:58 -0500 (Wed, 27 Jan 2010)
New Revision: 9763

Modified:
   trunk/mapserver/mapogcsld.c
Log:
Fix possible crash with regular expression parsing #2720

Modified: trunk/mapserver/mapogcsld.c
===================================================================
--- trunk/mapserver/mapogcsld.c	2010-01-26 17:17:59 UTC (rev 9762)
+++ trunk/mapserver/mapogcsld.c	2010-01-27 18:21:58 UTC (rev 9763)
@@ -5187,13 +5187,13 @@
         if (pszFinalAttributeValue && strlen(pszFinalAttributeValue) > 2 && 
             strcasecmp(pszComparionValue, "PropertyIsLike") == 0)
         {
+            int len = strlen(pszFinalAttributeValue);
             msStringTrimBlanks(pszFinalAttributeValue);
-            if (pszFinalAttributeValue[0] == '/' &&  pszFinalAttributeValue[strlen(pszFinalAttributeValue)-1] == '/')
+            if (pszFinalAttributeValue[0] == '/' &&  pszFinalAttributeValue[len-1] == '/')
             {
-                pszFinalAttributeValue[strlen(pszFinalAttributeValue)-1] = '\0';
-                pszFinalAttributeValue = pszFinalAttributeValue+1;
-                if (pszFinalAttributeValue[0] == '^')
-                  pszFinalAttributeValue++;
+                pszFinalAttributeValue[len-1] = '\0';
+                memmove(pszFinalAttributeValue, pszFinalAttributeValue +
+                        ((pszFinalAttributeValue[1] == '^') ? 2 : 1), len-1);
 
                 /*replace wild card string .* with * */
                 pszFinalAttributeValue = msReplaceSubstring(pszFinalAttributeValue, ".*", "*");



More information about the mapserver-commits mailing list