Skip to content

Commit 5f31c44

Browse files
committed
- Add missing check
1 parent 25aee9c commit 5f31c44

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Zend/zend_constants.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -479,7 +479,8 @@ ZEND_API int zend_register_constant(zend_constant *c TSRMLS_DC)
479479
|| zend_hash_add(EG(zend_constants), name, c->name_len, (void *) c, sizeof(zend_constant), NULL)==FAILURE) {
480480

481481
/* The internal __COMPILER_HALT_OFFSET__ is prefixed by NULL byte */
482-
if (memcmp(name, "\0__COMPILER_HALT_OFFSET__", sizeof("\0__COMPILER_HALT_OFFSET__")) == 0) {
482+
if (c->name[0] == '\0' && c->name_len > sizeof("\0__COMPILER_HALT_OFFSET__")
483+
&& memcmp(name, "\0__COMPILER_HALT_OFFSET__", sizeof("\0__COMPILER_HALT_OFFSET__")) == 0) {
483484
name++;
484485
}
485486
zend_error(E_NOTICE,"Constant %s already defined", name);

0 commit comments

Comments
 (0)