1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00

Merge branch 'PHP-8.4' into PHP-8.5

* PHP-8.4:
  exp/pgsql: insert/update query string build possible UB fix.
This commit is contained in:
David Carlier
2026-01-19 06:17:40 +00:00
2 changed files with 6 additions and 2 deletions

4
NEWS
View File

@@ -34,6 +34,10 @@ PHP NEWS
. Fixed bug GH-20882 (buildFromIterator breaks with missing base directory).
(ndossche)
- PGSQL:
. Fixed INSERT/UPDATE queries building with PQescapeIdentifier() and possible
UB. (David Carlier)
- Readline:
. Fixed bug GH-18139 (Memory leak when overriding some settings
via readline_info()). (ndossche)

View File

@@ -5681,7 +5681,7 @@ PHP_PGSQL_API zend_result php_pgsql_insert(PGconn *pg_link, const zend_string *t
goto cleanup;
}
if (opt & PGSQL_DML_ESCAPE) {
tmp = PQescapeIdentifier(pg_link, ZSTR_VAL(fld), ZSTR_LEN(fld) + 1);
tmp = PQescapeIdentifier(pg_link, ZSTR_VAL(fld), ZSTR_LEN(fld));
if (tmp == NULL) {
php_error_docref(NULL, E_NOTICE, "Failed to escape field '%s'", ZSTR_VAL(fld));
goto cleanup;
@@ -5866,7 +5866,7 @@ static inline int build_assignment_string(PGconn *pg_link, smart_str *querystr,
return -1;
}
if (opt & PGSQL_DML_ESCAPE) {
char *tmp = PQescapeIdentifier(pg_link, ZSTR_VAL(fld), ZSTR_LEN(fld) + 1);
char *tmp = PQescapeIdentifier(pg_link, ZSTR_VAL(fld), ZSTR_LEN(fld));
if (tmp == NULL) {
php_error_docref(NULL, E_NOTICE, "Failed to escape field '%s'", ZSTR_VAL(fld));
return -1;