cbpporter Messages: 1428 Registered: September 2007
Ultimate Contributor
Quote:
Than again if such OS allocators allow to allocate only for example 4kB chunks and not 13 bytes, I think it will never raise exception or crash and you may safely read beyond end of buffer.
That is true, but it will not allocate those 4KB for every 13 bytes you want, only if the previoslly allocated 4KB chunk is full. Your requested pointer may be on the end of that allocated zone, and here you could have big problems.
Anyway, this is a memcmp operation, so even if you don't crash, just getting gibberish data could compromise the functionality.