[php-src] PR #26044: ext/sysvmsg: Terminate the message that msg_receive() unserializes
| From: | sebastianbergmann | Date: | Thu, 03 Dec 2026 06:14:58 +0000 |
| Subject: | [php-src] PR #26044: ext/sysvmsg: Terminate the message that msg_receive() unserializes | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-41385@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/26044
Author: sebastianbergmann
msg_receive() passes the message it received to the unserializer without terminating
it. The unserializer may read the byte that follows its input, for instance to find out where the
digits of an integer end. For a message that is not complete serialized data, it therefore read the
uninitialized memory that follows the message in the receive buffer. When that memory held matching
data, msg_receive() returned a value that was never sent: in the test that is added
here, the message "i:1" was received as int(12345).
Terminate the message. struct php_msgbuf has room for one char in addition
to the message, so the size of the allocation does not have to change.
This was discovered as part of https://github.com/php/php-src/pull/26026#issuecomment-7369387535.