Skip to content
Request an audit

‹ All findings

Don't return the same memory variable if your passing it as argument

Low/InfoFuji Finance·Three Sigma · Lending aggregator · 6th May, 20233S-FUJI-N19

Description

In BaseRouter, _bundleInternal(...), the tokensToCheck array is updated in tokensToCheck = _addTokenToList(token, tokensToCheck);. In _addTokenToList(...), the token is added to the array if it is not present yet, which modifies the tokensToCheck in the outer scope of the function; there is no need to return it

  • when a variable is passed as memory to an internal function, the same memory location is used, solidity does not create a copy.

Recommendation

Change _addTokenToList(...) to not return anything.

Status

Addressed here: Fujicracy/fuji-v2#622