malloc and buffer overflow attacks
Era Scarecrow
rtcvb32 at yahoo.com
Mon Jan 3 01:34:38 UTC 2022
On Monday, 3 January 2022 at 01:29:11 UTC, Adam Ruppe wrote:
> On Monday, 3 January 2022 at 00:52:38 UTC, Brian Callahan wrote:
>> Perhaps D should provide a similar function
> ```d
> int[] array;
>
> array.length = 5;
> ```
I don't think that helps...
```d
long cnt=60, itemsize=100;
array.length = cnt*itemsize; //cannot pass argument `cnt *
itemsize` of type `long` to parameter `uint newlength`
```
Even if you do your math there and it overflows, it's the same
problem as using malloc.
More information about the Digitalmars-d
mailing list