[mapserver-commits] r9622 - trunk/mapserver
svn at osgeo.org
svn at osgeo.org
Fri Dec 18 09:35:51 EST 2009
Author: dmorissette
Date: 2009-12-18 09:35:51 -0500 (Fri, 18 Dec 2009)
New Revision: 9622
Modified:
trunk/mapserver/mapfile.c
Log:
Avoid env. var. leak through msEvalRegex() (#2989)
Modified: trunk/mapserver/mapfile.c
===================================================================
--- trunk/mapserver/mapfile.c 2009-12-17 21:55:25 UTC (rev 9621)
+++ trunk/mapserver/mapfile.c 2009-12-18 14:35:51 UTC (rev 9622)
@@ -105,7 +105,7 @@
if(ms_regexec(&re, s, 0, NULL, 0) != 0) { /* no match */
ms_regfree(&re);
- msSetError(MS_REGEXERR, "String (%s) failed expression test.", "msEvalRegex()", s);
+ msSetError(MS_REGEXERR, "String failed expression test.", "msEvalRegex()");
return(MS_FALSE);
}
ms_regfree(&re);
@@ -5172,9 +5172,15 @@
}
if(getenv("MS_MAPFILE_PATTERN")) { /* user override */
- if(msEvalRegex(getenv("MS_MAPFILE_PATTERN"), filename) != MS_TRUE) return(NULL);
+ if(msEvalRegex(getenv("MS_MAPFILE_PATTERN"), filename) != MS_TRUE) {
+ msSetError(MS_REGEXERR, "MS_MAPFILE_PATTERN validation failed." , "msLoadMap()");
+ return(NULL);
+ }
} else { /* check the default */
- if(msEvalRegex(MS_DEFAULT_MAPFILE_PATTERN, filename) != MS_TRUE) return(NULL);
+ if(msEvalRegex(MS_DEFAULT_MAPFILE_PATTERN, filename) != MS_TRUE) {
+ msSetError(MS_REGEXERR, "MS_DEFAULT_MAPFILE_PATTERN validation failed." , "msLoadMap()");
+ return(NULL);
+ }
}
/*
@@ -5497,11 +5503,17 @@
** Check map filename to make sure it's legal
*/
if(getenv("MS_MAPFILE_PATTERN")) { /* user override */
- if(msEvalRegex(getenv("MS_MAPFILE_PATTERN"), filename) != MS_TRUE) return(NULL);
+ if(msEvalRegex(getenv("MS_MAPFILE_PATTERN"), filename) != MS_TRUE) {
+ msSetError(MS_REGEXERR, "MS_MAPFILE_PATTERN validation failed." , "msLoadMap()");
+ return(NULL);
+ }
} else { /* check the default */
- if(msEvalRegex(MS_DEFAULT_MAPFILE_PATTERN, filename) != MS_TRUE) return(NULL);
+ if(msEvalRegex(MS_DEFAULT_MAPFILE_PATTERN, filename) != MS_TRUE) {
+ msSetError(MS_REGEXERR, "MS_DEFAULT_MAPFILE_PATTERN validation failed." , "msLoadMap()");
+ return(NULL);
+ }
}
-
+
if((msyyin = fopen(filename,"r")) == NULL) {
msSetError(MS_IOERR, "(%s)", "msTokenizeMap()", filename);
return NULL;
More information about the mapserver-commits
mailing list