<p>
    In the following example, the length of the dynamic array is changed directly:
</p>
<pre>
<code>
pragma solidity 0.4.24;

contract dataStorage {
    uint[] public data;

    function writeData(uint[] _data) external {
        for(uint i = data.length; i < _data.length; i++) {
            data.length++;
            data[i]=_data[i];
        }
    }
}
</code>
</pre>
<p>
    Secure alternative:
</p>
<pre>
<code>
pragma solidity 0.4.24;

contract dataStorage {
    uint[] publi