Skip to content

Commit 46983d5

Browse files
committed
- Add missing check
1 parent e0858b4 commit 46983d5

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Zend/zend_constants.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,8 @@ ZEND_API int zend_register_constant(zend_constant *c TSRMLS_DC)
440440
|| zend_hash_add(EG(zend_constants), name, c->name_len, (void *) c, sizeof(zend_constant), NULL)==FAILURE) {
441441

442442
/* The internal __COMPILER_HALT_OFFSET__ is prefixed by NULL byte */
443-
if (memcmp(name, "\0__COMPILER_HALT_OFFSET__", sizeof("\0__COMPILER_HALT_OFFSET__")) == 0) {
443+
if (c->name[0] == '\0' && c->name_len > sizeof("\0__COMPILER_HALT_OFFSET__")
444+
&& memcmp(name, "\0__COMPILER_HALT_OFFSET__", sizeof("\0__COMPILER_HALT_OFFSET__")) == 0) {
444445
name++;
445446
}
446447
zend_error(E_NOTICE,"Constant %s already defined", name);

0 commit comments

Comments
 (0)