Current-Users archive

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

Re: Fwd: snprintf?



On Mon, Jun 08, 2015 at 12:24:26PM -0400, Andrew Cagney wrote:
> I just found a bug in an embedded port of lua which didn't support
> sprintf().  Specifically, the work-around:
> 
>     #define sprintf(s,fmt,...)  snprintf(s, sizeof(s), fmt, __VA_ARGS__)
> 
> is broken.

snprintf(s, SIZE_MAX, fmt, __VA_ARGS__)

or even (uintptr_t)(-1) - (uintptr_t)s.

Joerg


Home | Main Index | Thread Index | Old Index