On 06.05.2014 2:59, Warner Losh wrote:
> Stupid is as stupid does. malloc and realloc both have this same issue. While 
> an interesting theoretical attack, the size doesn’t necessarily come from 
> multiplication. Careful coding is still required, not matter what spin you 
> put on this. reallocf() solves the memory leak issue, but not the problem 
> with overflow (which the realloc() interface has too). The caller can check 
> to make sure they aren’t requesting too much memory and overflowing. The 
> interface isn’t designed to solve the problem you are complaining about.
> 
> There’s only so much you can do to prevent programming errors. calloc() isn’t 
> going to solve the world’s problems for you, and introduces a non-trivial 
> amount of overhead for the trivial amount of overhead that is “saved” by 
> moving the overflow check from the caller to the callee...

I agree completely.

-- 
http://ache.vniz.net/

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to