Skip to content

Return Value of Call Ignored

SAFE-0258 Best Practice Checked automatically by the scanner
1

What goes wrong

A function that returns a status/amount is called and its return value is discarded (not a low-level call, but e.g. an ERC20 bool, a queue pop result, or a sub-call success). Failures or partial results go unnoticed.

2

The vulnerable pattern

proof of concept — how it is exploited
// pool.remove(id); // returns bool success, ignored
// remove() returns false (id not found) but the caller proceeds as if
// it worked -> inconsistent accounting.
3

How to fix it

the pattern that is safe
bool ok = registry.tryRegister(x);
require(ok, "register failed");
Check meaningful return values.
4

Where this has happened

Largest recorded losses in the same failure class — related, not the same bug:

Check your own contract for this

The SaferICO scanner runs 201 detectors over your Solidity source, SAFE-0258 among them. Paste an address or the source itself — a small per-scan fee, shown before you sign, or unlimited on any plan.

Run the scanner See how it is attacked Read the docs