Out-of-Bounds Error in getPositionsForCurator Function #215
Labels
bug
Something isn't working
downgraded by judge
Judge downgraded the risk level of this issue
duplicate-72
edited-by-warden
grade-a
Q-30
QA (Quality Assurance)
Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax
🤖_59_group
AI based duplicate group recommendation
satisfactory
satisfies C4 submission criteria; eligible for awards
sufficient quality report
This report is of sufficient quality
Lines of code
https://github.com/code-423n4/2024-08-phi/blob/main/src/Cred.sol#L480-L523
Vulnerability details
Impact
The current implementation of the
getPositionsForCurator
function has a potential out-of-bounds error. Specifically, thecredIds
andamounts
arrays are populated using thei
variable, which starts fromstart_
, causing an incorrect index that can lead to an out-of-bounds error and unexpected behavior.If the provided
start_
value is greater than zero, the index will start incorrectly, leading to potential array bounds errors resulting in corruption or exceptions during execution. This can disrupt the proper functionality of thegetPositionsForCurator
function, leading to unexpected results and breaking the logic of the contract.Proof of Concept
Below is the problematic code in the
getPositionsForCurator
function:Tools Used
Manual code review
Recommended Mitigation Steps
Use the
index
variable instead ofi
to populate thecredIds
andamounts
arrays, ensuring they are populated correctly even whenstart_
is greater than zero.Here is the final corrected implementation for clarity:
Assessed type
Invalid Validation
The text was updated successfully, but these errors were encountered: