[php-src] PR #22348: Fix buffer overflow converting @@IDENTITY in pdo_dblib lastInsertId
| From: | iliaal | Date: | Tue, 16 Jun 2026 22:51:21 +0000 |
| Subject: | [php-src] PR #22348: Fix buffer overflow converting @@IDENTITY in pdo_dblib lastInsertId | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-36476@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/22348
Author: iliaal
dblib_handle_last_id() converts @@IDENTITY into a 32-byte buffer with
dbconvert()'s destination length set to -1, which disables FreeTDS's
destination bounds check. A numeric(p,0) IDENTITY column with precision
above 30 produces a textual form longer than 32 bytes (31 digits plus a
sign plus the NUL), overflowing the buffer.
Size the buffer for the widest @@IDENTITY (numeric(38,0) = 38 digits +
sign + NUL = 40 bytes) and pass the real destination length, mirroring
the existing fix in pdo_dblib_stmt_stringify_col().