[PECL-CVS] [pecl-database-ibm_db2] fix-docref-printf: Fix docref printf specification
[email protected] (Calvin Buckley) Tue, 17 Mar 2026 14:04:22 +0000
| Newsgroups | php.pecl.cvs |
|---|---|
| Message-ID | <[email protected]> |
Author: Calvin Buckley (NattyNarwhal)
Date: 2026-03-17T11:00:49-03:00
Commit: https://github.com/php/pecl-database-ibm_db2/commit/0114af2086de6f4bc9c6e3363e691e28866176e5
Raw diff: https://github.com/php/pecl-database-ibm_db2/commit/0114af2086de6f4bc9c6e3363e691e28866176e5.diff
Fix docref printf specification
If the message from Db2 has a '%' in it, then it risks those being
interpreted as printf specifiers that aren't in the argument list.
Wrap it with a '%s' specifier to avoid interpreting this.
This only affects IBM i.
Changed paths:
M ibm_db2.c
Diff:
diff --git a/ibm_db2.c b/ibm_db2.c
index 7130a04..9017db1 100644
--- a/ibm_db2.c
+++ b/ibm_db2.c
@@ -1045,7 +1045,7 @@ static void _php_db2_check_sql_errors( SQLHANDLE handle, SQLSMALLINT hType, int
sprintf((char *)errMsg, "%s SQLCODE=%d", msg, (int)sqlcode);
#ifdef PASE /* 1.9.7 - IBM i consultant request log additional information into php.log */
if (IBM_DB2_G(i5_log_verbose) > 0) {
- php_error_docref(NULL, E_WARNING, (char *)errMsg);
+ php_error_docref(NULL, E_WARNING, "%s", (char *)errMsg);
}
#endif /* PASE */
switch (rc) {