# 29322 - \[SC - Insight] Use safeTransfer instead of transfer

Submitted on Mar 14th 2024 at 00:40:23 UTC by @bugtester for [Boost | ZeroLend](https://immunefi.com/bounty/zerolend-boost/)

Report ID: #29322

Report type: Smart Contract

Report severity: Insight

Target: <https://github.com/zerolend/governance>

Impacts:

* Permanent freezing of funds

## Description

## Brief/Intro

transfer() might return false instead of reverting, in this case, ignoring return value leads to considering it successful.

use safeTransfer() or check the return value if length of returned data is > 0.

## Vulnerability Details

A call to transferFrom or transfer is frequently done without checking the results. For certain ERC20 tokens, if insufficient tokens are present, no revert occurs but a result of "false" is returned. So its important to check this. in case, ignoring return value leads to considering it successful. and loss of funds

## Impact Details

transfer() might return false instead of reverting, in this case, ignoring return value leads to considering it successful. and cause permanent loss of funds

## Fix

Use safeTransfer instead of transfer

## Proof of concept

<https://github.com/zerolend/governance/blob/a30d8bb825306dfae1ec5a5a47658df57fd1189b/contracts/vesting/VestedZeroNFT.sol#L223C2-L228C1>

function claimUnvested(uint256 tokenId) external { require(msg.sender == stakingBonus, "!stakingBonus"); uint256 \_pending = unclaimed(tokenId); zero.transfer(msg.sender, \_pending); }

<https://github.com/zerolend/governance/blob/a30d8bb825306dfae1ec5a5a47658df57fd1189b/contracts/vesting/VestedZeroNFT.sol#L176C1-L177C1>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://reports.immunefi.com/zerolend/29322-sc-insight-use-safetransfer-instead-of-transfer.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
