mirror of
https://github.com/php/php-src.git
synced 2025-08-15 21:48:51 +02:00
Fix -Walloc-size warning
It's indeed unsafe to treat zend_internal_function as zend_function, because sizeof(zend_internal_function) < sizeof(zend_function), which can lead to buffer overflows. This might also be UB. Either way, this would need to be addressed in the whole codebase.
This commit is contained in:
parent
529a71ff2e
commit
782af7a963
1 changed files with 1 additions and 1 deletions
|
@ -97,7 +97,7 @@ static zend_function *zend_duplicate_internal_function(zend_function *func, zend
|
|||
zend_function *new_function;
|
||||
|
||||
if (UNEXPECTED(ce->type & ZEND_INTERNAL_CLASS)) {
|
||||
new_function = pemalloc(sizeof(zend_internal_function), 1);
|
||||
new_function = (zend_function *)pemalloc(sizeof(zend_internal_function), 1);
|
||||
memcpy(new_function, func, sizeof(zend_internal_function));
|
||||
} else {
|
||||
new_function = zend_arena_alloc(&CG(arena), sizeof(zend_internal_function));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue