felipe                                   Sun, 14 Nov 2010 01:38:52 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=305332

Log:
- Add missing check

Changed paths:
    U   php/php-src/branches/PHP_5_3/Zend/zend_constants.c
    U   php/php-src/trunk/Zend/zend_constants.c

Modified: php/php-src/branches/PHP_5_3/Zend/zend_constants.c
===================================================================
--- php/php-src/branches/PHP_5_3/Zend/zend_constants.c  2010-11-13 23:13:07 UTC 
(rev 305331)
+++ php/php-src/branches/PHP_5_3/Zend/zend_constants.c  2010-11-14 01:38:52 UTC 
(rev 305332)
@@ -440,7 +440,8 @@
                || zend_hash_add(EG(zend_constants), name, c->name_len, (void 
*) c, sizeof(zend_constant), NULL)==FAILURE) {

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

Modified: php/php-src/trunk/Zend/zend_constants.c
===================================================================
--- php/php-src/trunk/Zend/zend_constants.c     2010-11-13 23:13:07 UTC (rev 
305331)
+++ php/php-src/trunk/Zend/zend_constants.c     2010-11-14 01:38:52 UTC (rev 
305332)
@@ -479,7 +479,8 @@
                || zend_hash_add(EG(zend_constants), name, c->name_len, (void 
*) c, sizeof(zend_constant), NULL)==FAILURE) {

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

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to