malloc and buffer overflow attacks

Era Scarecrow rtcvb32 at
Mon Jan 3 01:29:14 UTC 2022

On Monday, 3 January 2022 at 00:57:55 UTC, rikki cattermole wrote:
> That sounds similar to my idea of callocSlice but applied to 
> realloc as well.
> Which absolutely is the solution here I think. Using malloc 
> directly should be a red flag.

  mhmm.. i think we need a helper function, which is malloc(size, 
count) much like calloc, the test/protections are done in the 
helper. If a slice is returned then bounds checking is 
incorporated when we cast it to something else. So i agree with 
that idea, though using malloc/calloc slice vs malloc/calloc...

  It does make me wonder if my ScaledInt will be incorporated so 
cent/ucent can be used natively (*division being the only real 
complicated and slow part of the code*). Reminds me, i gotta get 
back to the optional crypto instruction set to make it faster.

More information about the Digitalmars-d mailing list