[php-src] PR #16680: Fix GH-16628: FPM logs are getting corrupted with this log statement

From: Date: Sat, 02 Nov 2024 12:06:48 +0000
Subject: [php-src] PR #16680: Fix GH-16628: FPM logs are getting corrupted with this log statement
Groups: php.git-pulls 
Request: Send a blank email to git-pulls+get-29481@lists.php.net to get a copy of this message
Pull Request: https://github.com/php/php-src/pull/16680 Author: nielsdos zlog_buf_prefix() can return a larger length than what actually was written due to its use of snprintf(). The code in zlog_stream_prefix_ex() does not take this into account, other callers do. What ends up happening then is that stream->length is set to the length as if snprintf() was able to write all bytes, causing stream->length to become larger than stream->buf.size, causing a segfault. In case the buffer was too small we try with a larger buffer up to a limit of zlog_limit. This makes sure that the stream length will remain bounded by the buffer size. This also adds assertions to make the programmer intent clear and catch this more easily in debug builds.

« previous php.git-pulls (#29481) next »