[GIT-PULLS] [php-src] PR #22776: ext/odbc: do not mutate the caller's DSN string

[email protected] (iliaal) Thu, 16 Jul 2026 20:41:16 +0000
Newsgroups php.git-pulls
Message-ID <[email protected]>
Pull Request: https://github.com/php/php-src/pull/22776
Author: iliaal

`odbc_sqlconnect()` stripped a trailing `;` by writing a NUL into the caller’s DSN `zend_string`. Shared variables, interned literals, and `const` values used as the DSN were permanently altered (`strlen` unchanged, last byte became NUL).

Compute a base length instead and pass it to `spprintf` with `%.*s`. Does not touch the argument buffer.

`ext/pdo_odbc` already copies before mutating and does not need a change.