near-daos / sputnik-dao-contract

Smart contracts for https://app.astrodao.com
https://astrodao.com/
MIT License
107 stars 76 forks source link

Remove 'unsafe' keyword from the smart contracts #151

Closed ctindogaru closed 2 years ago

ctindogaru commented 2 years ago

Use env calls instead of sys to remove unsafe keyword and ensure memory safety.

The issue was reported by the Halborn team while doing an audit of the sputnik smart contracts.

Original description of the issue: Rust code that uses the unsafe keyword is considered unsafe, since all of the memory safety guarantees of Rust are not enforced there. It means that the code might be prone to vulnerabilities that would’ve been prevented by the compiler, such as Buffer Overflow, Double free, Use After free, and more.

ctindogarus4f commented 2 years ago

Hey Trevor, thanks for the feedback. I would not change any logic in this PR. If you'd like we can open a new one and address those issues :D. This PR should be strictly about removing the unsafe keyword.

ctindogarus4f commented 2 years ago

I've accidentally opened this PR against the audit branch. Will close it and open the same PR against main.