The getFertilizers function is designed to retrieve a list of fertilizers by traversing a linked list structure. However, it lacks a check for the length of the linked list, potentially leading to an unbounded loop if the length is not properly constrained. This can result in excessive gas consumption and even contract failures due to running out of gas.
The absence of a length check for the linked list can lead to an unbounded loop, causing the function to consume excessive gas or run out of gas entirely. This can disrupt the functioning of the contract and may render it unusable.
Manual review
Add a length check for the linked list to ensure that the loop terminates within a reasonable number of iterations. This can be done by either setting a maximum limit on the length of the linked list or implementing a mechanism to detect the end of the list. Additionally, consider implementing thorough testing and auditing procedures to detect and prevent unbounded loops during development and deployment.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.