Skip to content

Latest commit

 

History

History
21 lines (8 loc) · 554 Bytes

22.md

File metadata and controls

21 lines (8 loc) · 554 Bytes

Improper Array Deletion

Description:

In Solidity, we remove an element from an array using the “delete” function. However, the length and sequence of the array may not remain as expected. If we delete the array index x, we will see that the array length remains the same, just that the value at index x has been set to zero.

Remediation:

Instead of “delete” and “.length=0”, use push and pop functions to interact with array elements.

References:

https://blog.solidityscan.com/improper-array-deletion-82672eed8e8d