code-423n4 / 2021-07-pooltogether-findings

0 stars 0 forks source link

Usage of safeApprove #75

Closed code423n4 closed 3 years ago

code423n4 commented 3 years ago

Handle

pauliax

Vulnerability details

Impact

function approveMax uses safeApprove. This function only works if the current approval is 0. Consider clearing previous approval ( safeApprove(0) ) before setting the max value again. The same issue can happen with SwappableYieldSource if, for example, source A is set but later changed to source B (_setYieldSource) and later you want to set source A again. safeApprove should fail as A already has approval. I think it would also make sense to clear approval of the old yield source when _setYieldSource is invoked as this old source becomes inactive so you don't want it to still have the approval to transfer the tokens.

PierrickGT commented 3 years ago

Duplicate of https://github.com/code-423n4/2021-07-pooltogether-findings/issues/47 and https://github.com/code-423n4/2021-07-pooltogether-findings/issues/3