[mapserver-commits] r7557 - trunk/mapserver
svn at osgeo.org
svn at osgeo.org
Fri May 2 12:36:33 EDT 2008
Author: pramsey
Date: 2008-05-02 12:36:32 -0400 (Fri, 02 May 2008)
New Revision: 7557
Modified:
trunk/mapserver/mapserv.c
trunk/mapserver/maptile.c
Log:
Add some guards around bad data sent into tile= parameter.
Modified: trunk/mapserver/mapserv.c
===================================================================
--- trunk/mapserver/mapserv.c 2008-05-02 14:25:33 UTC (rev 7556)
+++ trunk/mapserver/mapserv.c 2008-05-02 16:36:32 UTC (rev 7557)
@@ -874,6 +874,10 @@
if(strcasecmp(msObj->request->ParamNames[i],"tile") == 0) {
+ if( strlen(msObj->request->ParamValues[i]) < 1 ) {
+ msSetError(MS_WEBERR, "Empty tile parameter.", "loadForm()");
+ writeError();
+ }
msObj->CoordSource = FROMTILE;
msObj->TileCoords = strdup(msObj->request->ParamValues[i]);
Modified: trunk/mapserver/maptile.c
===================================================================
--- trunk/mapserver/maptile.c 2008-05-02 14:25:33 UTC (rev 7556)
+++ trunk/mapserver/maptile.c 2008-05-02 16:36:32 UTC (rev 7557)
@@ -71,9 +71,15 @@
int x, y, zoom;
double zoomfactor;
- coords = msStringSplit(msObj->TileCoords, ' ', &(num_coords));
- if( num_coords != 3 ) {
- msSetError(MS_WEBERR, "Invalid number of tile coordinates (should be three).", "msTileSetup()");
+ if( msObj->TileCoords ) {
+ coords = msStringSplit(msObj->TileCoords, ' ', &(num_coords));
+ if( num_coords != 3 ) {
+ msSetError(MS_WEBERR, "Invalid number of tile coordinates (should be three).", "msTileSetup()");
+ return(MS_FAILURE);
+ }
+ }
+ else {
+ msSetError(MS_WEBERR, "Tile parameter not set.", "msTileSetup()");
return(MS_FAILURE);
}
@@ -133,12 +139,18 @@
int x, y, zoom;
double zoomfactor, tilesize, xmin, xmax, ymin, ymax;
- coords = msStringSplit(msObj->TileCoords, ' ', &(num_coords));
- if( num_coords != 3 ) {
- msSetError(MS_WEBERR, "Invalid number of tile coordinates (should be three).", "msTileSetExtent()");
+ if( msObj->TileCoords ) {
+ coords = msStringSplit(msObj->TileCoords, ' ', &(num_coords));
+ if( num_coords != 3 ) {
+ msSetError(MS_WEBERR, "Invalid number of tile coordinates (should be three).", "msTileSetExtent()");
+ return(MS_FAILURE);
+ }
+ }
+ else {
+ msSetError(MS_WEBERR, "Tile parameter not set.", "msTileSetup()");
return(MS_FAILURE);
- }
-
+ }
+
x = strtol(coords[0], NULL, 10);
y = strtol(coords[1], NULL, 10);
zoom = strtol(coords[2], NULL, 10);
More information about the mapserver-commits
mailing list