[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Nmh-workers] strncpy(3), die, die, die.

From: Todd C. Miller
Subject: Re: [Nmh-workers] strncpy(3), die, die, die.
Date: Mon, 24 Oct 2016 15:18:35 -0600

On Mon, 24 Oct 2016 22:10:46 +0100, Ralph Corderoy wrote:

> Yes, asprintf(3) is very handy.  Unfortunately, it's not standardised; C
> nor POSIX.  And rolling your own version around vsnprintf(3) can mean
> doing the formatting twice;  the first time to get the length.  You've
> then a malloc'd pointer to track.  So it's a more of a change than I
> want to tackle now.  This is the kind of thing I've been doing.
> http://git.savannah.gnu.org/cgit/nmh.git/commit/?id=9b3fc4790b2473b23c69c0e70
> 710e1e66a038f28&context=1

For what it's worth, you are welcome to use the BSD-licensed
asprintf() sudo uses when the host system lacks it.  It is based
on the BSD vfprintf.c so you only need to do the formatting once.
The only caveat is that it doesn't support floating point by default.

I can certainly understand not wanting to make radical changes at
this point.  If you do find in the future that it would be useful,
please let me know.

 - todd

reply via email to

[Prev in Thread] Current Thread [Next in Thread]