Permalink
Browse files

WCS server: fix segfaults (in WCS 1.0.0) when layers in the mapfile h…

…ave no NAME defined
  • Loading branch information...
1 parent 43ae71b commit 250ca818ff8590801b0e018941230ba0513b60e2 @rouault rouault committed Jun 19, 2013
Showing with 5 additions and 5 deletions.
  1. +5 −5 mapwcs.c
View
@@ -250,7 +250,7 @@ void msWCSFreeParams(wcsParamsObj *params)
int msWCSIsLayerSupported(layerObj *layer)
{
/* only raster layers, are elligible to be served via WCS, WMS rasters are not ok */
- if((layer->type == MS_LAYER_RASTER) && layer->connectiontype != MS_WMS) return MS_TRUE;
+ if((layer->type == MS_LAYER_RASTER) && layer->connectiontype != MS_WMS && layer->name != NULL) return MS_TRUE;
return MS_FALSE;
}
@@ -1335,7 +1335,7 @@ static int msWCSDescribeCoverage(mapObj *map, wcsParamsObj *params, owsRequestOb
for(i=0; i<map->numlayers; i++) {
coverageName = msOWSGetEncodeMetadata(&(GET_LAYER(map, i)->metadata), "CO", "name", GET_LAYER(map, i)->name);
- if( EQUAL(coverageName, coverages[k]) &&
+ if( coverageName != NULL && EQUAL(coverageName, coverages[k]) &&
(msIntegerInArray(GET_LAYER(map, i)->index, ows_request->enabled_layers, ows_request->numlayers)) ) {
msFree(coverageName);
break;
@@ -1356,7 +1356,7 @@ this request. Check wcs/ows_enable_request settings.", "msWCSDescribeCoverage()"
updatesequence = msOWSLookupMetadata(&(map->web.metadata), "CO", "updatesequence");
if (!updatesequence)
- updatesequence = msStrdup("0");
+ updatesequence = "0";
/* printf("Content-Type: application/vnd.ogc.se_xml%c%c",10,10); */
if (encoding)
@@ -1383,7 +1383,7 @@ this request. Check wcs/ows_enable_request settings.", "msWCSDescribeCoverage()"
for(k=0; k<numcoverages; k++) {
for(i=0; i<map->numlayers; i++) {
coverageName = msOWSGetEncodeMetadata(&(GET_LAYER(map, i)->metadata), "CO", "name", GET_LAYER(map, i)->name);
- if( EQUAL(coverageName, coverages[k]) ) {
+ if( coverageName != NULL && EQUAL(coverageName, coverages[k]) ) {
msFree(coverageName);
break;
}
@@ -1617,7 +1617,7 @@ static int msWCSGetCoverage(mapObj *map, cgiRequestObj *request,
lp = NULL;
for(i=0; i<map->numlayers; i++) {
coverageName = msOWSGetEncodeMetadata(&(GET_LAYER(map, i)->metadata), "CO", "name", GET_LAYER(map, i)->name);
- if( EQUAL(coverageName, params->coverages[0]) &&
+ if( coverageName != NULL && EQUAL(coverageName, params->coverages[0]) &&
(msIntegerInArray(GET_LAYER(map, i)->index, ows_request->enabled_layers, ows_request->numlayers)) ) {
lp = GET_LAYER(map, i);
free( coverageName );

0 comments on commit 250ca81

Please sign in to comment.