Skip to content

Commit 6993b7d

Browse files
committed
Merge branch 'PHP-8.5'
* PHP-8.5: Fix buffer overflow converting @@IDENTITY in pdo_dblib lastInsertId
2 parents 7dc2d9b + 757898b commit 6993b7d

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

ext/pdo_dblib/dblib_driver.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ zend_string *dblib_handle_last_id(pdo_dbh_t *dbh, const zend_string *name)
231231
pdo_dblib_db_handle *H = (pdo_dblib_db_handle *)dbh->driver_data;
232232

233233
RETCODE ret;
234-
BYTE id[32];
234+
BYTE id[40];
235235
size_t len;
236236

237237
/*
@@ -264,7 +264,7 @@ zend_string *dblib_handle_last_id(pdo_dbh_t *dbh, const zend_string *name)
264264
return NULL;
265265
}
266266

267-
len = dbconvert(NULL, (dbcoltype(H->link, 1)) , (dbdata(H->link, 1)) , (dbdatlen(H->link, 1)), SQLCHAR, (BYTE *)id, (DBINT)-1);
267+
len = dbconvert(NULL, (dbcoltype(H->link, 1)) , (dbdata(H->link, 1)) , (dbdatlen(H->link, 1)), SQLCHAR, (BYTE *)id, (DBINT)sizeof(id));
268268
dbcancel(H->link);
269269

270270
return zend_string_init((const char *) id, len, 0);

0 commit comments

Comments
 (0)