[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: 4.0 core dump from printf -v foo %s b
From: |
Andreas Schwab |
Subject: |
Re: 4.0 core dump from printf -v foo %s b |
Date: |
Thu, 12 Nov 2009 15:33:02 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) |
Greg Wooledge <wooledg@eeg.ccf.org> writes:
> It doesn't mention a null pointer. The OpenBSD man page does explicitly
> say the null pointer is allowed if size is zero. The GNU/Linux man page
> says that SUSv2 and C99 disagree, but that the implementation follows
> C99 (allowing the null pointer when size is 0).
Note that there are more differences between SUSv2 and POSIX.1-2008/C99:
The SUSv2 version of snprintf returns the actual number of bytes written
(excluding the terminating NUL if any), whereas the C99 version returns
the number of bytes that would have been written (excluding the
terminating NUL) if the buffer would be big enough.
Andreas.
--
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."