Skip to content

Commit

Permalink
Make sure requested class with mode=legendicon is not negative. (#6357)
Browse files Browse the repository at this point in the history
* Make sure the requested class index is not negative.
  • Loading branch information
sdlime committed Jul 2, 2021
1 parent 0db046c commit 46fb2a1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion mapservutil.c
Expand Up @@ -1661,7 +1661,7 @@ int msCGIDispatchLegendIconRequest(mapservObj *mapserv)

if(numtokens == 2) { /* check the class index */
classindex = atoi(tokens[1]);
if(classindex >= GET_LAYER(mapserv->map, layerindex)->numclasses) {
if(classindex < 0 || classindex >= GET_LAYER(mapserv->map, layerindex)->numclasses) {
msSetError(MS_WEBERR, "Icon class=%d not found in layer=%s.", "mapserv()", classindex, GET_LAYER(mapserv->map, layerindex)->name);
status = MS_FAILURE;
goto li_cleanup;
Expand Down

0 comments on commit 46fb2a1

Please sign in to comment.