Re: [ZEND-ENGINE-CVS] cvs: ZendEngine2(PHP_5_1) / zend_operators.c
| From: | Andi Gutmans | Date: | Tue, 13 Dec 2005 20:09:36 +0000 |
| Subject: | Re: [ZEND-ENGINE-CVS] cvs: ZendEngine2(PHP_5_1) / zend_operators.c | ||
| References: | 1 2 3 | Groups: | php.zend-engine.cvs |
| Request: | Send a blank email to php-zend-engine-cvs+get-4454@lists.php.net to get a copy of this message | ||
Stas pointed out that we aren't using it for sub-strings today, so keeping your fix probably makes sense. Might be worth adding a comment to the top of a function that it null-terminates...
At 12:32 PM 12/12/2005, Marcus Boerger wrote:
Hello Andi, actually it is the other way round. We have not a single place that uses this function wher the end is not supposed to become a \0. But we a) have lots of code that needs hacks to enable that \0. Actually we have quite some copying going on to ensure this. Also If we do not intend to enforce that \0 we will definitively not add some random character but stop right in front of it. Sorry for doing this wrong in the first place. The reason it was copying from the source was that I thought it would be fatser. regards marcus Monday, December 12, 2005, 8:19:46 PM, you wrote: This seems more like a hack to fix bugs elsewhere. My main problem is that this changes behavior and requires this function to be used on null-terminated strings. So now it doesn't work for substrings nor in situations where it might not be null-terminated. Please revert this patch and fix the place which is calling it incorrectly. Thanks. At 11:10 AM 12/12/2005, Marcus Boerger wrote:08.2.1&r2=1.208.2.2&diff_format=uhelly Mon Dec 12 19:10:13 2005 EDTModified files: (Branch: PHP_5_1) /ZendEngine2 zend_operators.cLog: - Enforce termination to prevent possible SEGVs http://cvs.php.net/viewcvs.cgi/ZendEngine2/zend_operators.c?r1=1.2+----------------------------------------------------------------------+Index: ZendEngine2/zend_operators.c diff -u ZendEngine2/zend_operators.c:1.208.2.1 ZendEngine2/zend_operators.c:1.208.2.2--- ZendEngine2/zend_operators.c:1.208.2.1 Mon Sep 12 11:48:56 2005 +++ ZendEngine2/zend_operators.c Mon Dec 12 19:10:12 2005@@ -17,7 +17,7 @@Best regards, Marcus*/ -/* $Id: zend_operators.c,v 1.208.2.1 2005/09/12 11:48:56 dmitry Exp $ */ +/* $Id: zend_operators.c,v 1.208.2.2 2005/12/12 19:10:12 helly Exp $ */ #include <ctype.h> @@ -1783,7 +1783,7 @@while (str < end) { *result++ = tolower((int)*str++); } - *result = *end; + *result = '\0';return dest;} -- Zend Engine CVS Mailing List (http://cvs.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php