Skip to content

Commit

Permalink
mapwcs: use large enough output buffer for snprintf
Browse files Browse the repository at this point in the history
  • Loading branch information
gogglesguy committed Aug 20, 2018
1 parent 9b95631 commit d18302b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion mapwcs.c
Expand Up @@ -1721,7 +1721,7 @@ static int msWCSGetCoverage(mapObj *map, cgiRequestObj *request,
outputFormatObj *format; outputFormatObj *format;
char *bandlist=NULL; char *bandlist=NULL;
size_t bufferSize = 0; size_t bufferSize = 0;
char numbands[8]; /* should be large enough to hold the number of bands in the bandlist */ char numbands[12]; /* should be large enough to hold the number of bands in the bandlist */
coverageMetadataObj cm; coverageMetadataObj cm;
rectObj reqextent; rectObj reqextent;
rectObj covextent; rectObj covextent;
Expand Down
4 changes: 2 additions & 2 deletions mapwcs20.c
Expand Up @@ -3955,7 +3955,7 @@ static int msWCSGetCoverage20_GetBands(mapObj *map, layerObj *layer,
if(NULL == params->range_subset) { if(NULL == params->range_subset) {
*bandlist = msStrdup("1"); *bandlist = msStrdup("1");
for(i = 1; i < cm->numbands; ++i) { for(i = 1; i < cm->numbands; ++i) {
char strnumber[10]; char strnumber[12];
snprintf(strnumber, sizeof(strnumber), ",%d", i + 1); snprintf(strnumber, sizeof(strnumber), ",%d", i + 1);
*bandlist = msStringConcatenate(*bandlist, strnumber); *bandlist = msStringConcatenate(*bandlist, strnumber);
} }
Expand Down Expand Up @@ -4310,7 +4310,7 @@ int msWCSGetCoverage20(mapObj *map, cgiRequestObj *request,


int status, i; int status, i;
double x_1, x_2, y_1, y_2; double x_1, x_2, y_1, y_2;
char *coverageName, *bandlist=NULL, numbands[8]; char *coverageName, *bandlist=NULL, numbands[12];


int doDrawRasterLayerDraw = MS_TRUE; int doDrawRasterLayerDraw = MS_TRUE;
GDALDatasetH hDS = NULL; GDALDatasetH hDS = NULL;
Expand Down

0 comments on commit d18302b

Please sign in to comment.