Skip to content

Commit 0901b57

Browse files
sdlimejmckenna
authored andcommitted
Make sure requested class with mode=legendicon is not negative. (#6357)
* Make sure the requested class index is not negative.
1 parent 024af02 commit 0901b57

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

mapservutil.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1651,7 +1651,7 @@ int msCGIDispatchLegendIconRequest(mapservObj *mapserv)
16511651

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

0 commit comments

Comments
 (0)