Vulnerability Development mailing list archives

Re: Administrivia: List Announcement


From: Luciano Miguel Ferreira Rocha <strange () nsk no-ip org>
Date: Wed, 14 May 2003 15:45:29 +0100

On Tue, May 13, 2003 at 10:45:21AM -0700, Brian Hatch wrote:
And for goodness sake, let's cast things properly if you're going
to malloc, and for good form include the size of the element, even
when it's a char:

      char *buf1 = (char*)malloc( SIZE * sizeof(char) );
No, bad idea.

If malloc isn't defined, the compiler will cast an int to a pointer, which
may not be the same size.

If malloc is (well) defined, it returns a type of (void *), well casted to
any pointer by the compiler.

Regards,
Luciano Rocha


Current thread: