Re: [ZEND-ENGINE-CVS] cvs: ZendEngine2 / zend_constants.c
| From: | Andi Gutmans | Date: | Wed, 04 Jun 2003 04:31:38 +0000 |
| Subject: | Re: [ZEND-ENGINE-CVS] cvs: ZendEngine2 / zend_constants.c | ||
| References: | 1 2 3 | Groups: | php.zend-engine.cvs |
| Request: | Send a blank email to php-zend-engine-cvs+get-1318@lists.php.net to get a copy of this message | ||
At 12:07 AM 6/4/2003 +0200, Marcus Börger wrote:
The next thing i did which i will not revert is the following diff (notice the versions): RCS file: /repository/ZendEngine2/zend_constants.c,v retrieving revision 1.48 retrieving revision 1.51 diff -u -p -r1.48 -r1.51Again, this doesn't look like a thorough fix (I might be wrong). If in one case it requires you to allocate ce->name_len+1 and in another ce->name_len then someplace in the Engine isn't consistent. The correct way is to find it and fix it if possible. It doesn't make sense that ce->name_len in one case includes the terminating null and in the other it doesn't. Also in the first case don't you need to copy ce->name_len in order to copy the terminating null too? Can you please check this? Andi--- Zend/zend_constants.c 21 May 2003 22:57:51 -0000 1.48 +++ Zend/zend_constants.c 1 Jun 2003 16:20:23 -0000 1.51@@ -244,11 +244,12 @@ ZEND_API int zend_register_constant(zend printf("Registering constant for module %d\n", c->module_number);#endif- lowercase_name = do_alloca(c->name_len + 1);-if (!(c->flags & CONST_CS)) { - zend_str_tolower_copy(lowercase_name, c->name, c->name_len); + /* keep in mind that c->name_len already contains the '\0' */ + lowercase_name = do_alloca(c->name_len); + zend_str_tolower_copy(lowercase_name, c->name, c->name_len - 1); } else { + lowercase_name = do_alloca(c->name_len + 1); memcpy(lowercase_name, c->name, c->name_len); lowercase_name[c->name_len] = '\0'; }