This is an automated email from the git hooks/post-receive script. sebastic pushed a commit to branch master in repository mapcache.
commit b4361f5cf1f6c3cc4f62110a6b9d9ce7f81d7522 Author: Bas Couwenberg <sebas...@xs4all.nl> Date: Sat Sep 30 09:23:25 2017 +0200 New upstream version 1.6.1 --- CMakeLists.txt | 2 +- include/mapcache.h | 8 ++++++++ lib/cache_tiff.c | 2 +- lib/service_wms.c | 6 +++--- lib/service_wmts.c | 4 +++- lib/source_gdal.c | 2 +- lib/util.c | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 7 files changed, 64 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3d4edc5..f47fea5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -13,7 +13,7 @@ endif () set (MAPCACHE_VERSION_MAJOR 1) set (MAPCACHE_VERSION_MINOR 6) -set (MAPCACHE_VERSION_REVISION 0) +set (MAPCACHE_VERSION_REVISION 1) if(NOT DEFINED CMAKE_INSTALL_LIBDIR) set(CMAKE_INSTALL_LIBDIR lib) diff --git a/include/mapcache.h b/include/mapcache.h index 2622e72..f747eb3 100644 --- a/include/mapcache.h +++ b/include/mapcache.h @@ -1341,6 +1341,14 @@ char* mapcache_util_quadkey_encode(mapcache_context *ctx, int x, int y, int z); */ char* mapcache_util_str_sanitize(apr_pool_t *pool, const char *str, const char* from, char to); +typedef enum { + MAPCACHE_UTIL_XML_SECTION_TEXT, + MAPCACHE_UTIL_XML_SECTION_ATTRIBUTE, + MAPCACHE_UTIL_XML_SECTION_COMMENT +} mapcache_util_xml_section_type; + +char* mapcache_util_str_xml_escape(apr_pool_t *pool, const char *str, mapcache_util_xml_section_type xml_section_type); + char* mapcache_util_get_tile_dimkey(mapcache_context *ctx, mapcache_tile *tile, char* sanitized_chars, char *sanitize_to); char* mapcache_util_get_tile_key(mapcache_context *ctx, mapcache_tile *tile, char *stemplate, diff --git a/lib/cache_tiff.c b/lib/cache_tiff.c index 6a4f115..a576602 100644 --- a/lib/cache_tiff.c +++ b/lib/cache_tiff.c @@ -302,7 +302,7 @@ static TIFF* mapcache_cache_tiff_open(mapcache_context *ctx, _tiffMapProc, _tiffUnmapProc ); } -static void mapcache_cache_tiff_gdal_error_handler(CPLErr eErr, +static void CPL_STDCALL mapcache_cache_tiff_gdal_error_handler(CPLErr eErr, int error_num, const char* pszMsg) { diff --git a/lib/service_wms.c b/lib/service_wms.c index 0ac1845..97e0566 100644 --- a/lib/service_wms.c +++ b/lib/service_wms.c @@ -1033,9 +1033,7 @@ void _format_error_wms(mapcache_context *ctx, mapcache_service *service, char *m \"http://schemas.opengis.net/wms/1.1.1/exception_1_1_1.dtd\">\n\ <ServiceExceptionReport version=\"1.1.1\">\n\ <ServiceException>\n\ -<![CDATA[\n\ %s\n\ -]]>\n\ </ServiceException>\n\ %s\ </ServiceExceptionReport>"; @@ -1052,7 +1050,9 @@ void _format_error_wms(mapcache_context *ctx, mapcache_service *service, char *m } } - *err_body = apr_psprintf(ctx->pool,template,msg,exceptions); + *err_body = apr_psprintf(ctx->pool,template, + mapcache_util_str_xml_escape(ctx->pool, msg, MAPCACHE_UTIL_XML_SECTION_TEXT), + exceptions); apr_table_set(headers, "Content-Type", "application/vnd.ogc.se_xml"); } diff --git a/lib/service_wmts.c b/lib/service_wmts.c index f12f1d4..3add6d2 100644 --- a/lib/service_wmts.c +++ b/lib/service_wmts.c @@ -1014,7 +1014,9 @@ void _error_report_wmts(mapcache_context *ctx, mapcache_service *service, char * "<Exception exceptionCode=\"%s\" locator=\"%s\"/>",elts[i].key,elts[i].val),NULL); } - *err_body = apr_psprintf(ctx->pool,template,msg,exceptions); + *err_body = apr_psprintf(ctx->pool,template, + mapcache_util_str_xml_escape(ctx->pool, msg, MAPCACHE_UTIL_XML_SECTION_COMMENT), + exceptions); apr_table_set(headers, "Content-Type", "application/xml"); diff --git a/lib/source_gdal.c b/lib/source_gdal.c index 440d10d..3cf7846 100644 --- a/lib/source_gdal.c +++ b/lib/source_gdal.c @@ -571,7 +571,7 @@ void _mapcache_source_gdal_render_metatile(mapcache_context *ctx, mapcache_sourc #endif if( eErr != CE_None ) { - ctx->set_error(ctx, 500,"GDAL I/O error occured"); + ctx->set_error(ctx, 500,"GDAL I/O error occurred"); GDALClose(hDstDS); /* close first this one, as it references hTmpDS or hSrcDS */ if( hTmpDS ) GDALClose(hTmpDS); /* references hSrcDS, so close before */ diff --git a/lib/util.c b/lib/util.c index bd01d25..8559df3 100644 --- a/lib/util.c +++ b/lib/util.c @@ -185,6 +185,53 @@ char* mapcache_util_str_sanitize(apr_pool_t *pool, const char *str, const char* return pstr; } +char* mapcache_util_str_xml_escape(apr_pool_t *pool, const char *str, + mapcache_util_xml_section_type xml_section_type) +{ + int outpos = 0; + char* outstr = apr_pcalloc(pool, 6 * strlen(str) + 1); + for( ; *str != '\0'; str ++ ) { + if( xml_section_type == MAPCACHE_UTIL_XML_SECTION_COMMENT ) { + if( *str == '-' ) { + memcpy(outstr + outpos, "-", 5); + outpos += 5; + } + else { + outstr[outpos] = *str; + outpos ++; + } + } + else { + if( *str == '&' ) { + memcpy(outstr + outpos, "&", 5); + outpos += 5; + } + else if( *str == '<' ) { + memcpy(outstr + outpos, "<", 4); + outpos += 4; + } + else if( *str == '>' ) { + memcpy(outstr + outpos, ">", 4); + outpos += 4; + } + else if( *str == '"' ) { + memcpy(outstr + outpos, """, 6); + outpos += 6; + } + else if( *str == '\'' ) { + /* See https://github.com/mapserver/mapserver/issues/1040 */ + memcpy(outstr + outpos, "'", 5); + outpos += 5; + } + else { + outstr[outpos] = *str; + outpos ++; + } + } + } + return outstr; +} + #if APR_MAJOR_VERSION < 1 || (APR_MAJOR_VERSION < 2 && APR_MINOR_VERSION < 3) APR_DECLARE(apr_table_t *) apr_table_clone(apr_pool_t *p, const apr_table_t *t) { -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-grass/mapcache.git _______________________________________________ Pkg-grass-devel mailing list Pkg-grass-devel@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-grass-devel