Sonar error pertainging to looop

We are seeing following vulnerability in the issues section of sonarcube report

ERROR:

Change this code is not set loop bounds directly from user controlled data.

Screenshot:

Please suggest fix

Hi,

Did you click on the ‘Why is this an issue?’ and ‘How can I fix it?’ tabs above the code snippet?

 
Ann