Skip to content

Commit 757898b

Browse files
committed
Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4: Fix buffer overflow converting @@IDENTITY in pdo_dblib lastInsertId
2 parents d824308 + 1a5a81c commit 757898b

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
@@ -233,7 +233,7 @@ zend_string *dblib_handle_last_id(pdo_dbh_t *dbh, const zend_string *name)
233233
pdo_dblib_db_handle *H = (pdo_dblib_db_handle *)dbh->driver_data;
234234

235235
RETCODE ret;
236-
BYTE id[32];
236+
BYTE id[40];
237237
size_t len;
238238

239239
/*
@@ -266,7 +266,7 @@ zend_string *dblib_handle_last_id(pdo_dbh_t *dbh, const zend_string *name)
266266
return NULL;
267267
}
268268

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

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

0 commit comments

Comments
 (0)