Re: Reasons not to like asprintf - Mailing list pgsql-hackers

From Florian Weimer
Subject Re: Reasons not to like asprintf
Date
Msg-id 52677486.90207@redhat.com
Whole thread Raw
In response to Re: Reasons not to like asprintf  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
On 10/22/2013 11:06 PM, Tom Lane wrote:

> Attached is a draft, which compiles though I've not yet actually tested it.
nprinted = vsnprintf(buf, len, fmt, args);
Assert(buf[len - 1] == '\0');

The assert may fire if len > INT_MAX and the system returns with errno 
== EOVERFLOW, as required by POSIX.  It's probably better to move it 
after the error logging.

-- 
Florian Weimer / Red Hat Product Security Team



pgsql-hackers by date:

Previous
From: Florian Weimer
Date:
Subject: Re: Why the asprintf patch is still breaking the buildfarm
Next
From: Samrat Revagade
Date:
Subject: Review of pg_rewind