Re: [hackers] [st] Add xmalloc and xrealloc wrappers || "Roberto E. Vargas Caballero"

From: Joerg Zinke <mail_AT_umaxx.net>
Date: Thu, 13 Sep 2012 23:31:00 +0200

Am 13.09.2012 um 20:43 schrieb 123 <p37sitdu_AT_lavabit.com>:

> On Thu, Sep 13, 2012 at 06:57:15PM +0400, 123 wrote:
>> On Thu, Sep 13, 2012 at 04:37:51PM +0200, Joerg Zinke wrote:
>> Check for zero size is not required in st.
>> Check for NULL pointer
>> is not requried at all, realloc with NULL ptr is equivalent to
>> malloc.

But may not be wanted as otherwise you had called malloc(), right?

>> Only "SIZE_T_MAX / nmemb < size" check may be copied from OpenSSH.
>
> And this check can't be copied, cause there is no nmemb in xrealloc.

There is a reason for the additional nmemb argument: in conjunction
with the if condition above it may avoid size_t overflows.
Received on Thu Sep 13 2012 - 23:31:00 CEST

This archive was generated by hypermail 2.3.0 : Thu Sep 13 2012 - 23:36:07 CEST