Skip to content

Commit 7f78f66

Browse files
committed
Merge branch 'PHP-8.1'
2 parents 80fda5f + a6a1313 commit 7f78f66

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

ext/pdo_firebird/firebird_statement.c

+9-1
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,15 @@ static int firebird_fetch_blob(pdo_stmt_t *stmt, int colno, zval *result, ISC_QU
305305
zend_ulong cur_len;
306306
unsigned short seg_len;
307307
ISC_STATUS stat;
308-
zend_string *str = zend_string_alloc(len, 0);
308+
zend_string *str;
309+
310+
/* prevent overflow */
311+
if (len > ZSTR_MAX_LEN) {
312+
result = 0;
313+
goto fetch_blob_end;
314+
}
315+
316+
str = zend_string_alloc(len, 0);
309317

310318
for (cur_len = stat = 0; (!stat || stat == isc_segment) && cur_len < len; cur_len += seg_len) {
311319

0 commit comments

Comments
 (0)