#33938 [Opn->Bgs]: Dangerous INIT_OVERLOADED_CLASS_ENTRY design flaw
| From: | sniper@php.net | Date: | Sun, 31 Jul 2005 22:43:15 +0000 |
| Subject: | #33938 [Opn->Bgs]: Dangerous INIT_OVERLOADED_CLASS_ENTRY design flaw | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-82742@lists.php.net to get a copy of this message | ||
ID: 33938
Updated by: sniper@php.net
Reported By: dan dot colascione at gmail dot com
-Status: Open
+Status: Bogus
Bug Type: Scripting Engine problem
Operating System: Linux
PHP Version: 5.0.4
New Comment:
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
Previous Comments:
------------------------------------------------------------------------
[2005-07-31 22:11:20] dan dot colascione at gmail dot com
Description:
------------
The INIT_OVERLOADED_CLASS_ENTRY macro assumes that it's being passed a
static string array for its class_name parameter. It obtains the length
of the string with sizeof(), when it should be using strlen. This leads
to class names being silently truncated when classes are initialized
with a string variable instead of a static string array.
Reproduce code:
---------------
char* a = get_some_string();
zend_class_entry ce;
INIT_OVERLOADED_CLASS_ENTRY(ce, a, ...);
Expected result:
----------------
The name of the class in ce should be the return value of
get_some_string()
Actual result:
--------------
The name of the class is truncated to sizeof(char*)-1 characters.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=33938&edit=1