[mapserver-commits] r12770 - trunk/mapserver/mapcache/src

svn at osgeo.org svn at osgeo.org
Tue Nov 15 05:22:32 EST 2011


Author: tbonfort
Date: 2011-11-15 02:22:32 -0800 (Tue, 15 Nov 2011)
New Revision: 12770

Modified:
   trunk/mapserver/mapcache/src/cache_tiff.c
Log:
apply sanitization to tiff filename template dimension entry


Modified: trunk/mapserver/mapcache/src/cache_tiff.c
===================================================================
--- trunk/mapserver/mapcache/src/cache_tiff.c	2011-11-15 10:18:11 UTC (rev 12769)
+++ trunk/mapserver/mapcache/src/cache_tiff.c	2011-11-15 10:22:32 UTC (rev 12770)
@@ -80,16 +80,8 @@
       int i = elts->nelts;
       while(i--) {
          apr_table_entry_t *entry = &(APR_ARRAY_IDX(elts,i,apr_table_entry_t));
-         char *dimval = apr_pstrdup(ctx->pool,entry->val);
-         char *iter = dimval;
-         while(*iter) {
-            /* replace dangerous characters by '#' */
-            if(*iter == '.' || *iter == '/') {
-               *iter = '#';
-            }
-            iter++;
-         }
-         dimstring = apr_pstrcat(ctx->pool,dimstring,"#",entry->key,"#",dimval,NULL);
+         const char *dimval = mapcache_util_str_sanitize(ctx->pool,entry->val,"/.",'#');
+         dimstring = apr_pstrcat(ctx->pool,dimstring,"#",dimval,NULL);
       }
       *path = mapcache_util_str_replace(ctx->pool,*path, "{dim}", dimstring);
    }



More information about the mapserver-commits mailing list