Re: cvs: php4 /main main.c
| From: | Sascha Schumann | Date: | Sat, 09 Sep 2000 05:22:43 +0000 |
| Subject: | Re: cvs: php4 /main main.c | ||
| References: | 1 | Groups: | php.cvs |
| Request: | Send a blank email to php-cvs+get-1657@lists.php.net to get a copy of this message | ||
On Fri, 8 Sep 2000, Stanislav Malyshev wrote:
> stas Fri Sep 8 05:32:29 2000 EDT
>
> Modified files:
> /php4/main main.c
> Log:
> Fix crash on very long error messages
> Manual for snprintf says:
> If the output was truncated, the return value is -1, oth-
> erwise it is the number of characters stored, not includ-
> ing the terminating null.
> And that's a blatant lie - in reality, libc 2.1 always returns number of
> characters that _would be_ stored. I hate those libc bugs. Now we should go
> and check every place we trusted snprintf return value.
Relying on (v)snprintf's return value is discouraged, because
it changes from implementation to implementation.
libc 2.1 behaves correctly though.
"Upon successful completion, the snprintf( ) function shall
return the number of bytes that would be written to s had n
been sufficiently large excluding the terminating null byte.
- Sascha