mailing list archives
Re: [PATCH] size_t and safe_*alloc()
From: Fyodor <fyodor () insecure org>
Date: Thu, 2 Mar 2006 14:55:56 -0800
On Thu, Mar 02, 2006 at 04:33:39PM -0600, Kris Katterjohn wrote:
The attached patch changes int to size_t for the safe_*alloc() functions. K&R
says that size_t is unsigned, so there's no need to check for negative values.
safe_realloc() had it size_t before, and it was still checking for negatives!
Thanks. I have applied this for the next version (due out within a
week). But I kept the negative numbers check (casted back to int), as
many bugs -- including some exploitable security ones -- have been
caused by callers passing negative values to memory allocation
functions. Nmap should never be allocating gigs of memory anyway.
Sent through the nmap-dev mailing list